6 if __name__
== "__main__":
12 print win
.width(), win
.height()
13 print list.selectedItemRow()
15 scr
.runModalLoop(win2
.view())
21 def breakLoop(btn
, data
):
26 def dc(object, data
, action
):
27 print "didChange:", object, data
, action
29 def dbe(object, data
, action
):
30 print "didBeginEditing:", object, data
, action
32 def dee(object, data
, action
):
33 if action
== wings
.WMReturnTextMovement
:
35 object.setFocusTo(txt2
)
37 object.setFocusTo(txt
)
38 print "didEndEditing:", object, data
, action
, object.text()
41 old
= list.selectedItemRow()
42 list.selectItem(list.index
)
43 list.unselectItem(old
)
44 list.index
= (list.index
+1) % 3
47 scr
= WMScreen("foobar")
48 win
= WMWindow(scr
, "aWindow")
49 win
.setCloseAction(quit
)
50 win
.setTitle("test window")
52 win
.setInitialPosition((scr
.width
-win
.width())/2, (scr
.height
-win
.height())/2)
54 btn
= WMCommandButton(win
)
55 btn
.setText("Click Me")
60 sw
= WMSwitchButton(win
)
61 sw
.setText("Some option")
69 for i
in ["One", "Two", "Four"]:
70 r
= WMRadioButton(win
, r
)
86 list.allowMultipleSelection(1)
90 txtdel
= WMTextFieldDelegate()
91 txtdel
.data
= 'mydata'
92 txtdel
.didBeginEditing
= dbe
93 txtdel
.didEndEditing
= dee
96 txt
= WMTextField(win
)
99 txt
.setDelegate(txtdel
)
101 txt2
= WMTextField(win
, "01234567890")
104 txt2
.setDelegate(txtdel
)
107 txt
.setNextText(txt2
)
108 txt2
.setNextText(txt
)
110 label
= WMLabel(win
, "Text1:")
111 label
.setTextAlignment(WARight
)
116 label2
= WMLabel(win
, "mytext2:")
117 label2
.setTextAlignment(WARight
)
119 label2
.resize(55, 20)
122 btn
.setAction(click
, list)
124 frame
= WMFrame(win
, "My Frame")
125 frame
.resize(150, 50)
127 #frame.setRelief(WRPushed)
130 ebtn
= WMCommandButton(win
)
140 timer
= WMPersistentTimer(1000, tcb
, win
)
144 win2
= WMPanel(win
, "anotherWindow", WMTitledWindowMask
)
145 win2
.setTitle("transient test window")
147 win2
.setInitialPosition((scr
.width
-win2
.width())/2, (scr
.height
-win2
.height())/2)
149 btn7
= WMCommandButton(win2
)
150 btn7
.setText("Dismiss")
154 btn7
.setAction(breakLoop
)