From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2008-12-30 19:28:39
|
On Mon, 29 Dec 2008 23:22:55 -0800 "Alec Bennett" <wry...@gm...> wrote: > I'm trying to subclass the Minimal example so I can make the window > always on top. I'm having trouble doing it though. Can someone > possibly point out what I'm doing wrong? If I understand the PythonCard model.py source correctly, the Application object initializes the Background object but you have created an __init__ method in Minimal so that gets called instead. You don't then call the Background __init__ which does various other start-up tasks and I'm guessing that is why the application does not work. (You don't say what is wrong when you run it, but trying it here I just get a blank window). If you just want to add the STAY_ON_TOP style then try the following...it seems to work here: from PythonCard import model class Minimal(model.Background): def __init__(self, aParent, aBgRsrc): aBgRsrc.style = ['wx.DEFAULT_FRAME_STYLE','wx.STAY_ON_TOP'] model.Background.__init__(self, aParent, aBgRsrc) if __name__ == '__main__': app = model.Application(Minimal) app.MainLoop() aBgRsrc is the application bacground resource properties from the resource file. Adding an extra style is a bit tricky, but since you have set it to 'resizeable' and the Background object translates that into wx.DEFAULT_FRAME_STYLE you can replace that with the two item list. The Background object has been coded to eval() each item in the list (hence I've made them strings) and bitwise OR them. -- XXXXXXXXXXX |