Skip to Main Content
Python Programming On Win32
book

Python Programming On Win32

by Andy Robinson, Mark Hammond
January 2000
Intermediate to advanced content levelIntermediate to advanced
672 pages
21h 46m
English
O'Reilly Media, Inc.
Content preview from Python Programming On Win32

Building a Doubletalk Browser with wxPython

Okay, now let’s build something that’s actually useful and learn more about the wxPython framework along the way. As has been shown with the other GUI toolkits, we’ll build a small application around the Doubletalk class library that allows browsing and editing of transactions.

MDI Frame

We’re going to implement a Multiple Document Interface, where the child frames are different views of the transactional data, rather than separate “documents.” Just as with previous samples, the first thing to do is create an application class and have it create a main frame in its OnInit method:

class DoubleTalkBrowserApp(wxApp):
    def OnInit(self):
        frame = MainFrame(NULL)
        frame.Show(true)
        self.SetTopWindow(frame)
        return true

app = DoubleTalkBrowserApp(0)
app.MainLoop()

Since we are using MDI, there is a special class to use for the frame’s base class. Here is the code for the initialization method of the main application frame:

class MainFrame(wxMDIParentFrame): title = "Doubletalk Browser - wxPython Edition" def __init__(self, parent): wxMDIParentFrame.__init__(self, parent, -1, self.title) self.bookset = None self.views = [] if wxPlatform == '__WXMSW__': self.icon = wxIcon('chart7.ico', wxBITMAP_TYPE_ICO) self.SetIcon(self.icon) # create a statusbar that shows the time and date on the right sb = self.CreateStatusBar(2) sb.SetStatusWidths([-1, 150]) self.timer = wxPyTimer(self.Notify) self.timer.Start(1000) self.Notify() menu = self.MakeMenu(false) self.SetMenuBar(menu) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Python Programming - Second Edition

Advanced Python Programming - Second Edition

Quan Nguyen

Publisher Resources

ISBN: 1565926218Supplemental ContentErrata Page