13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>wxPython</strong> widgetshttp://www.zetcode.com/wxpython/widgets/#!/usr/bin/python# statictext.pyimport wxclass StaticText(wx.Frame):def __init__(self, parent, id, title):wx.Frame.__init__(self, parent, id, title)lyrics1 = '''I'm giving up the ghost of lovein the shadows cast on devotionShe is the one that I adorecreed of my silent suffocationBreak this bittersweet spell on melost in the arms of destiny'''lyrics2 = '''<strong>The</strong>re is something in the wayYou're always somewhere elseFeelings have deserted meTo a point of no returnI don't believe in GodBut I pray for you'''vbox = wx.BoxSizer(wx.VERTICAL)panel = wx.Panel(self, -1)st1 = wx.StaticText(panel, -1, lyrics1, style=wx.ALIGN_CENTRE)st2 = wx.StaticText(panel, -1, lyrics2, style=wx.ALIGN_CENTRE)vbox.Add(st1, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 15)vbox.Add(st2, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 15)panel.SetSizer(vbox)self.Centre()self.Show(True)app = wx.App()StaticText(None, -1, 'statixtext.py')app.MainLoop()wx.StaticBoxThis is a kind of a decorator widget. It is used to logically groupvarious widgets. Note that this widget must be created before thewidgets that it contains, and that those widgets should be siblings,not children, of the static box.9 de 29 27/04/2008 1:04

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

Saved successfully!

Ooh no, something went wrong!