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/firststeps/Python IDEHome ContentsFaster, Easier Python Development Editor,Debugger, Browser, and morePortletsuite WebCMSOver 40 out-of-the-box portlets Direct usein BEA Portal 9.2First StepsSimple exampleWe start with a very simple example. Our first script willonly show a small window. It won't do much. We willanalyze the script line by line. Here is the code:#!/usr/bin/python# simple.pyimport wxapp = wx.App()frame = wx.Frame(None, -1, 'simple.py')frame.Show()app.MainLoop()#!/usr/bin/python# simple.py<strong>The</strong> first line is a she-bang followed by the path to a pythoninterpreter. <strong>The</strong> second line is a comment. It provides aname for the script.import wxThis line imports the basic <strong>wxPython</strong> modules. Namely thecore, controls, gdi, misc and windows. Technically wx is anamespace. All functions and objects from the basicmodules will start with a wx. prefix. <strong>The</strong> next line of codewill create an application object.1 de 8 27/04/2008 1:01

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

Saved successfully!

Ooh no, something went wrong!