wxPython: updating style of StaticText from event generated by button

Andrea Gavana andrea_gavana at tin.it
Wed Nov 2 19:01:44 EST 2005


Hello Kees,

> Thanks :), I'll give both of your hints a try. What I basically want to
> do is have something like an "old style" button in win xp that's either
> "up" or "down", since I couldn't find a more straightforward method I
> thought taking a text widget and adjusting the border at mouse click
> would be the best alternative no?

I would suggest you to take a look to the wxPython "custom" buttons; you can
find them in the demo, under "Custom Controls" ==> "GenericButtons". There
you will find "old style" buttons, that can be simple buttons or toggle
buttons (with "up" and "down" states). I have XP, and they look like "old
style" buttons. Moreover (just to promote my web site and my widgets, freely
available to all wxPython users ;-)))) ), if you would like to use
"non-rectangular" buttons-toggle buttons, you could take a look at:

http://xoomer.virgilio.it/infinity77/eng/freeware.html#shapedbutton

> One question then, what's the use of having a method like
> SetWindowStyle() if it doesn't really do anything at runtime? Is it
> indeed just intended for the few widgets that do support it?

This is more a wxWidgets question that a wxPython one. However, quoting the
wxWidgets manual:

wxWindow::SetWindowStyleFlag
virtual void SetWindowStyleFlag(long style)

Sets the style of the window. Please note that some styles cannot be changed
after the window creation and that Refresh() might be called after changing
the others for the change to take place immediately.

SetWindowStyleFlag is the same as SetWindowStyle. I don't have an answer to
your question, but maybe some wxWidgets expert can give you some more hints
(I don't use wxWidgets, only wxPython).

HTH.

Andrea.


"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77





More information about the Python-list mailing list