1 # Test FrameWork scrollbars
2 # Draw a window in which the user can type.
4 # This test expects Win, Evt and FrameWork (and anything used by those)
7 # Actually, it is more a test of FrameWork by now....
9 from FrameWork
import *
15 class MyWindow(ScrolledWindow
):
17 r
= (40, 40, 400, 300)
18 w
= Win
.NewWindow(r
, name
, 1, 0, -1, 1, 0x55555555)
19 self
.ourrect
= 0, 0, 360-SCROLLBARWIDTH
-1, 260-SCROLLBARWIDTH
-1
27 def getscrollbarvalues(self
):
28 return self
.vx
, self
.vy
30 def scrollbar_callback(self
, which
, what
, value
):
44 self
.vx
= self
.vx
+ delta
49 self
.vy
= self
.vy
+ delta
50 Win
.InvalRect(self
.ourrect
)
52 def do_update(self
, wid
, event
):
53 Qd
.EraseRect(self
.ourrect
)
55 Qd
.DrawString("x=%d, y=%d"%(self
.vx
, self
.vy
))
57 class TestSW(Application
):
59 Application
.__init
__(self
)
63 def makeusermenus(self
):
64 self
.filemenu
= m
= Menu(self
.menubar
, "File")
65 self
.newitem
= MenuItem(m
, "New window...", "O", self
.open)
66 self
.quititem
= MenuItem(m
, "Quit", "Q", self
.quit
)
68 def open(self
, *args
):
70 w
.open('Window %d'%self
.num
)
71 self
.num
= self
.num
+ 1
72 self
.listoflists
.append(w
)
74 def quit(self
, *args
):
77 def do_about(self
, id, item
, window
, event
):
78 EasyDialogs
.Message("""Test scrolling FrameWork windows""")
84 if __name__
== '__main__':