-
Notifications
You must be signed in to change notification settings - Fork 0
/
combobox.py
40 lines (28 loc) · 903 Bytes
/
combobox.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/ipy
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
from System.Windows.Forms import Application, Form
from System.Windows.Forms import ComboBox, Label
from System.Drawing import Size, Point
class IForm(Form):
def __init__(self):
self.Text = "ComboBox"
self.Size = Size(240, 240)
cb = ComboBox()
cb.Parent = self
cb.Location = Point(50, 30)
cb.Items.AddRange(("Ubuntu",
"Mandriva",
"Red Hat",
"Fedora",
"Gentoo"))
cb.SelectionChangeCommitted += self.OnChanged
self.label = Label()
self.label.Location = Point(50, 140)
self.label.Parent = self
self.label.Text = "..."
self.CenterToScreen()
def OnChanged(self, sender, event):
self.label.Text = sender.Text
Application.Run(IForm())