]>
Commit | Line | Data |
---|---|---|
1 | from wxPython.wx import * | |
2 | ||
3 | class MyWindow(wxScrolledWindow): | |
4 | def __init__(self,parent,id,pos,size,style): | |
5 | wxScrolledWindow.__init__(self,parent,id,pos,size,style) | |
6 | self.SetBackgroundColour(wxWHITE) | |
7 | ||
8 | def OnPaint(self,evt): | |
9 | dc = wxPaintDC(self) | |
10 | # normally call a redraw/draw function here. | |
11 | # this time, print 'redraw!' | |
12 | print "redraw!" | |
13 | ||
14 | ||
15 | class MyFrame(wxFrame): | |
16 | def __init__(self, parent, id, title): | |
17 | wxFrame.__init__(self, parent, id, title, | |
18 | wxPoint(100, 100), wxSize(500, 300)) | |
19 | ||
20 | self.sw = MyWindow(self, -1, | |
21 | wxDefaultPosition, wxDefaultSize, | |
22 | wxVSCROLL|wxSUNKEN_BORDER) | |
23 | ||
24 | self.sw.SetScrollbars(1,20,0,30) | |
25 | ||
26 | ||
27 | if __name__ == "__main__": | |
28 | class MyApp(wxApp): | |
29 | def OnInit(self): | |
30 | ||
31 | self.frame = MyFrame(NULL, -1, "Scrolling Test App") | |
32 | self.frame.Show(true) | |
33 | self.exiting = FALSE; | |
34 | return true | |
35 | ||
36 | app = MyApp(0) # Create an instance of the app class | |
37 | app.MainLoop() # Tell it to start processing events | |
38 |