Package Things :: Module ThingsApp :: Class AllThings
[frames] | no frames]

Class AllThings

       object --+    
                |    
timeline.Timeline --+
                    |
                   AllThings

This is the primary Timeline. You should instance this class to begin work. After that you add other Things to it.

An AllThings object has only one frame and cannot have keys. You should create at least one Thing object and add it to AllThings, then work from there.

Note

If you want to install custom fonts (using a BagOfStuff) then you should do so *before* you instantiate AllThings.

Use

  1. app = AllThings ( 400, 400, speed = 10, title = "TEST" )
  2. app.add( SomeOtherThing )
Instance Methods
 
__init__(self, canvas_width, canvas_height, window_width=None, window_height=None, speed=30, hideCursor=False, title='Things!')
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
add(self, *args, **kwargs)
Override of Timeline.add to cater for adding SceneThings to app.
 
version(self)
 
pause(self)
This will pause the app.
 
quit(self)
Call this to quit your app at the next opportunity.
 
getDrawingArea(self)
If you want to do fancy stuff directly to the canvas this will return the gtk.DrawingArea.
 
comeToLife(self)
Start the show! After all your Things are made and added, this command will send the volts flowing :)
 
mouse(self)
An easy way to get the mouse position.
 
cursor(self, shape='ARROW', hideCursor=False)
To change the cursor you send a string (a standard gtk name)
 
showGrid(self)
Call this to show a set of axes to get your bearings.
 
export(self, paf, type='png')
When this is called, Things will export each frame (to the window size, not canvas size) to the given file name, with a number added.
 
panZoom(self, yesno=True)
The idea is to allow you to zoom about the mouse (like Inscape does it), but I have not figured it out yet.
 
startScene(self, start)
Tell the app (AllThings) to start playing from a given scene.
 
playNextScene(self)
SceneThing objects can be added to an AllThings (app) object.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables

Inherited from timeline.Timeline: parentThing

Properties

Inherited from object: __class__

Method Details

__init__(self, canvas_width, canvas_height, window_width=None, window_height=None, speed=30, hideCursor=False, title='Things!')
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • window_width, window_height - Integer for the size of the window. If you exclude the canvas size, this will be the canvas size too.
  • canvas_width, canvas_height - Integer for the size of the Canvas. This is the area you will draw into with 0,0 in the middle. It's the area that you would have used in Inkscape, the area you think of as "the drawing". The window size can be bigger (or smaller) and the canvas will scale to fit it; if you resize the window this is what happens.
  • speed - Claims to be in milliseconds, but Python ain't that fast. An integer -- This sets the speed of the animation. I know that animation should be in strict frames per second, but I can't figure-out how to make this happen given all the other stuff (like jumps and stops) that happen in every frame. Halp!
  • title - What to say in the window title.
  • hideCursor - True/False. Will, um, hide the cursor.
Overrides: object.__init__

add(self, *args, **kwargs)

 

Override of Timeline.add to cater for adding SceneThings to app.

See Timeline.add

Parameters:
  • thing - The Thing you want to add.
  • layer - Layering of this thing (z-order.) 0 is the bottom. The default is to draw everything overlapping on layer zero. If you want to use thing.changeLayer() then make sure you give things layers that are > 0.
  • parentFrame - What frame number (in self) you want the thing being added to begin playing from. This is the same as padding the thing being added with blanks "....#" implies it starts from frame 5. So you could have "#" and set parentFrame = 5 instead.
  • globalProps - This is a Props() object. If you skip it, an ordinary Props() object is employed (position 0, alpha 1 etc.) If you want to control the placement/rotation of the Thing you are adding, then use this param.
Overrides: timeline.Timeline.add

pause(self)

 

This will pause the app. Go figure... Handy if you want to pop-up another window like a GTK dialog box.

getDrawingArea(self)

 

If you want to do fancy stuff directly to the canvas this will return the gtk.DrawingArea.

(It's simply the global instance named "Stack.stack", so you could use that too.)

comeToLife(self)

 

Start the show! After all your Things are made and added, this command will send the volts flowing :)

Note:

Always call this method last. It starts a loop and nothing gets done after it.

mouse(self)

 

An easy way to get the mouse position. It returns a tuple.

Use

  1. x,y = app.mouse()

cursor(self, shape='ARROW', hideCursor=False)

 

To change the cursor you send a string (a standard gtk name)

Param

  • hideCursor: True/False. Use this to re-show a hidden cursor (and set the shape) or simply to hide the cursor.
  • shape: One of:
           X_CURSOR            ARROW                BASED_ARROW_DOWN
           BASED_ARROW_UP      BOAT                 BOGOSITY
           BOTTOM_LEFT_CORNER  BOTTOM_RIGHT_CORNER  BOTTOM_SIDE
           BOTTOM_TEE          BOX_SPIRAL           CENTER_PTR
           CIRCLE              CLOCK                COFFEE_MUG
           CROSS               CROSS_REVERSE        CROSSHAIR
           DIAMOND_CROSS       DOT                  DOTBOX
           DOUBLE_ARROW        DRAFT_LARGE          DRAFT_SMALL
           DRAPED_BOX          EXCHANGE             FLEUR
           GOBBLER             GUMBY                HAND1
           HAND2               HEART                ICON
           IRON_CROSS          LEFT_PTR             LEFT_SIDE
           LEFT_TEE            LEFTBUTTON           LL_ANGLE
           LR_ANGLE            MAN                  MIDDLEBUTTON
           MOUSE               PENCIL               PIRATE
           PLUS                QUESTION_ARROW       RIGHT_PTR
           RIGHT_SIDE          RIGHT_TEE            RIGHTBUTTON
           RTL_LOGO            SAILBOAT             SB_DOWN_ARROW
           SB_H_DOUBLE_ARROW   SB_LEFT_ARROW        SB_RIGHT_ARROW
           SB_UP_ARROW         SB_V_DOUBLE_ARROW    SHUTTLE
           SIZING              SPIDER               SPRAYCAN
           STAR                TARGET               TCROSS
           TOP_LEFT_ARROW      TOP_LEFT_CORNER      TOP_RIGHT_CORNER
           TOP_SIDE            TOP_TEE              TREK
           UL_ANGLE            UMBRELLA             UR_ANGLE
           WATCH               XTERM                CURSOR_IS_PIXMAP
    

The default is "ARROW".

export(self, paf, type='png')

 

When this is called, Things will export each frame (to the window size, not canvas size) to the given file name, with a number added. The number is padded into 6 zeros: 000001, 000002 etc.

Parameters:
  • paf - A path and filename. If the path does not exist, there will be an error message. Make sure you create any needed directories.
  • type - You can choose "png" or "svg". This determines what kind of file is exported per frame.

panZoom(self, yesno=True)

 

The idea is to allow you to zoom about the mouse (like Inscape does it), but I have not figured it out yet. For the time being, this just zooms in/out with the mouse wheel.

startScene(self, start)

 

Tell the app (AllThings) to start playing from a given scene. Besides being the way you start things going, this is nice for development because you can skip scenes as you need.

playNextScene(self)

 

SceneThing objects can be added to an AllThings (app) object. To get the next one (they are in a sequence) to play, call this method.