[wxPython-users] Animated Effects and Pop-up Panels
Robin Dunn
robin at alldunn.com
Mon Feb 11 17:33:37 PST 2008
Aaron MacDonald wrote:
> I have two questions today about what is possible in wxPython. First I
> want to know how I can display short animation effects anywhere on the
> screen (not like throbbers). Secondly, I want to know how to go about
> making a panel that acts like a dialog but is still contained inside the
> application frame.
>
> 1) Animated Effects
>
> By this I do not mean something like a throbber where there's an
> animated picture that's always visible to the user. I mean effects that
> appear somewhere on the screen in response to some input or application
> occurrence and then disappear. For example, suppose I want a small
> explosion to appear where the user clicks, just because. So, I'd have
> one or more pictures (frames) to represent the explosion. When the user
> clicks somewhere, I'd get the mouse coordinates and display the frames
> one at a time at those coordinates with a short delay in between. The
> animation is no longer visible when finished playing, and any graphics
> that were under the animation are not affected. The animation itself
> should probably be clipped to be inside the main frame.
One way to handle this is to use a popup window like #2, and put the
throbber-like thing in that window. Another way would be to use a
wx.ScreenDC or a wx.WindowDC for the app's main frame. This will let
you draw over the top of what is already there in the screen buffer,
simulate transparency, etc. by blending with what is already in that
location in the DC, and when you are done it will only take a
mainFrame.Refresh() to make sure that the other widgets are redrawn and
updated.
>
> 2) Pop-up Panels
>
> Assume that I have a single frame. I want something like a dialog,
> except that I want it centered inside the frame and I want to be able to
> move the parent frame around. All input goes to the dialog, but it
> shouldn't act like a separate frame. I want it to look like a panel
> that lies on top of all the other panels that are in the parent frame.
We've got the wx.PopupWindow class that would be good for something like
this, although there is not an implementation for it on OSX yet.
Another way to do it would be to make another frame or dialog with no
caption, border, etc. and manage the size and position yourself as needed.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list