wxPython - simple example to add GUI to a server log file analysis
Archive - Originally posted on "The Horse's Mouth" - 2010-12-08 23:22:57 - Graham EllisOn our Python courses, we briefly introduce the various GUIs (Graphic User Interfaces), and where we have delegate(s) with an interest in one particular GUI, we'll spend a little longer on examples within a GUI. If delegates need to go deeper into GUI programming, we can provide an extra one day course on request - typically, we'll run that at a later date to ensure that the folks have good chance to practice the basics.
A GUI application (whether using TkInter, wxPython, or PyQt ...) is structured to run as follows:
a) Define the component parts of the GUI ("the widgets")
b) Define how they are laid out ("the geometry")
c) Define what's to be done when the user does something ("the event handlers")
d) Display the GUI
e) Enter a loop where the code waits for an event, and when it gets one it processes it
In wxPython, the widgets, geometry and event handlers are defined within a wx.Panel, which in built into a wx.Frame for display. The event handlers then call user defined methods to process events, which in turn call methods which are loaded from other modules / files / classes to perform the business logic (i.e. "real work") behind the GUI.
