I'm attempting to learn wxPython by writing a card game. Regardless of any code variations, the StaticBitmaps holding the card images always are drawn underneath all other widgets, even text. I'd like to control their layering, typically putting them on top. This is easy to do in VB. After buying wxPython in Action and searching the net I've had no help. PyGame has a scheme for ordering layers but it's not 100% reliable. Is there any possibility of using wxPython for games? Thanks.
Vic Huebner wrote:
I'm attempting to learn wxPython by writing a card game. Regardless of any code variations, the StaticBitmaps holding the card images always are drawn underneath all other widgets, even text. I'd like to control their layering, typically putting them on top. This is easy to do in VB. After buying wxPython in Action and searching the net I've had no help. PyGame has a scheme for ordering layers but it's not 100% reliable. Is there any possibility of using wxPython for games? Thanks.
wx officially doesn't support overlapping sibling widgets, and if you try to use or rely on layering the behavior is "undefined" at best.
On the other hand, for something like a card game you don't really want to be using widgets anyway, because they will limit you in other ways. Instead you should study up on the device context and/or graphics context classes and do all the drawing of the game area yourself.
Another alternative would be to use something like FloatCanvas. It will give you a higher level abstraction of the items being drawn, and also support things like finding out which of those objects was clicked on, and being able to move items around, handling all the low-level drawing for you.
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Robin Dunn wrote:
Vic Huebner wrote:
I'm attempting to learn wxPython by writing a card game. Regardless of any code variations, the StaticBitmaps holding the card images always are drawn underneath all other widgets, even text. I'd like to control their layering, typically putting them on top. This is easy to do in VB. After buying wxPython in Action and searching the net I've had no help. PyGame has a scheme for ordering layers but it's not 100% reliable. Is there any possibility of using wxPython for games? Thanks.
wx officially doesn't support overlapping sibling widgets, and if you try to use or rely on layering the behavior is "undefined" at best.
On the other hand, for something like a card game you don't really want to be using widgets anyway, because they will limit you in other ways. Instead you should study up on the device context and/or graphics context classes and do all the drawing of the game area yourself.
Another alternative would be to use something like FloatCanvas. It will give you a higher level abstraction of the items being drawn, and also support things like finding out which of those objects was clicked on, and being able to move items around, handling all the low-level drawing for you.
Thanks, I'll try to educate myself more.
Vic