13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

http://www.zetcode.com/wxpython/tips/Python IDEHome ContentsFaster, Easier Python Development Editor,Debugger, Browser, and moreeXtreme ProgrammingAssistance Technique Java/J2ee, .Net/C#,Python, RubyTips and TricksIn this section we will show various interesting tips in<strong>wxPython</strong>. Here we will see examples, that could not be putelsewhere.<strong>The</strong> tiniest <strong>wxPython</strong> applicationThis example is just for pure fun. Feel free to contact me, ifyou can shorthen it. Even for one single character. Exceptfor the path to the python interpreter.#!/usr/bin/pythonimport wxi = wx.App()wx.Frame(None).Show()i.MainLoop()Interactive ButtonThis tip shows how to program an interactive Button. Thisbutton reacts to users actions. In our case, the buttonchanges it's background colour. When we enter the area ofthe button widget with a mouse pointer,wx/EVT_ENTER_WINDOW event is generated. Simirarly,wx.EVT_LEAVE_WINDOW event is generated, when weleave the area of the widget. So all you have to do is to bindthose events to functions, that will change the colour/shapeof the button widget appropriately.#!/usr/bin/python# interactivebutton.py1 de 15 27/04/2008 1:09

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!