Friday, May 6, 2011

WinXP button-style with wxPython

Hi, guys.

I noticed that my programs written with wxPython have Win98 button style. But Boa Constructor (that is written using wxPython too) got pretty buttons.

How to make buttons look like current Windows buttons style?

From stackoverflow
  • Have you tried running your scripts with pythonw.exe instead of python.exe?

    Kirill Titov : I will try, but I think - no matter, 'cause the same app written using PyQt works perfectly, I think that's problem of wxPython.
  • Are you packaging the app with py2exe?

    If so you may need to specify a manifest file to make Python use the WinXP(Vista?) theme/Common Controls:

    http://wiki.wxpython.org/DistributingYourApplication

    Kirill Titov : OK, but how about Windows Vista or Windows 7 styles? Does this manifest support that styles?
    John Montgomery : Sorry Mac user, by WinXP i just mean "modern windows". I think it'll work for Vista too, but I only have an XP laptop for testing at home so YMMV.
  • Expanding on John's answer, you may also be able to create manifest files for python.exe and pythonw.exe to see the new styles without first packaging using py2exe.

  • The answers so far handle distributing the package as an executable (eg. py2exe), where the answer has already been given.

    But since (i think) python 2.6 you have the same problem when just starting the .py file from the commandline (Vista and Windows7). Robin Dunn suggested using update_manifest.py which he distributes with wxPython and puts it in the same directory as python.exe.

    After applying update_manifest.py using a copied version of python.exe wxPython apps have the correct themed look and yes it also works using windows7 RC1.

0 comments:

Post a Comment