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.

<strong>wxPython</strong> griptshttp://www.zetcode.com/wxpython/gripts/self.statusbar.SetFieldsCount(3)self.statusbar.SetStatusWidths([-5, -2, -1])def OnAbout(self, event):dlg = wx.MessageDialog(self, '\tEditor\t\n Another Tutorial\njan bodnar 2005-2006','About Editor', wx.OK | wx.ICON_INFORMATION)dlg.ShowModal()dlg.Destroy()app = wx.App()Editor(None, -1, 'Editor')app.MainLoop()KikaKika is a gript that connects to an ftp site. If a login is successfull, Kikashows a connected icon on the statusbar. Otherwise, a disconnected icon isdisplayed. We use an ftplib module from the python standard library. If youdo not have an ftp account, you can try to login to some anonymous ftpsites.Figure: Kika#!/usr/bin/python# kika.pyfrom ftplib import FTP, all_errorsimport wxclass MyStatusBar(wx.StatusBar):def __init__(self, parent):wx.StatusBar.__init__(self, parent)self.SetFieldsCount(2)self.SetStatusText('Welcome to Kika', 0)self.SetStatusWidths([-5, -2])self.icon = wx.StaticBitmap(self, -1, wx.Bitmap('icons/disconnected.png'))self.Bind(wx.EVT_SIZE, self.OnSize)8 de 12 27/04/2008 1:09

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

Saved successfully!

Ooh no, something went wrong!