Skinnable/Stylable windows in wxPython?

Daniel Bickett dbickett at gmail.com
Mon Dec 13 04:04:18 CET 2004


Solution found!

For the future reference of anyone searching:

The wxPopupWindow can easily be achieved by creating a wxMiniFrame
with absolutely no styles ('0', explicitly). The features of the
wxPopupWindow in the wxPython demo don't come with it, they were
manually added in the demo code, so simply adapting the code should
suffice.

Even as I was typing this message, I realized that this was probably
exactly what wxPopupWindow was, and suddenly this clicked because I
remembered seeing in the wxWindows help files that all of the styles
for wxMiniFrame only worked on Windows and Motif, and it made a point
to note that they didn't work on GTK. So I tried a snippet of code[1]
on my Mac (until then I had been working on a windows box) and, to my
surprise, it worked perfectly.

This raises some questions for me, like why, if the wxPython package
is going to have the wxPopupWindow feature, they don't simply inherit
wxMiniFrame like I did (quite literally, it looks /exactly/ the same
as a wxPopupWindow). Not only would this make it more multi-platform
(I have no access to a GTK machine so I don't know if this works.
Could someone please check?), but it would be more useful, considering
the fact that it is in fact a frame, and wouldn't have the problems
that M.E.Farmer outlined above regarding controls on wxPopupWindows.

Regardless, I'm happy that I've uncovered the answer, and I hope this
helps someone else in the same situation :)

Daniel Bickett

NOTES:
[1] from wxPython.wx import wxMiniFrame, wxPySimpleApp
app = wxPySimpleApp()
frame = wxMiniFrame( None , -1 , '' , size = ( 300 , 150 ) , style = 0 )
frame.Show()
app.MainLoop()



More information about the Python-list mailing list