-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathGUI.py
55 lines (42 loc) · 1.54 KB
/
GUI.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import wx
choice = "test"
def onButton():
print("Button pressed.")
app = wx.App()
frame = wx.Frame(None, -1, 'win.py')
frame.SetDimensions(0, 0, 200, 50)
dlg = wx.TextEntryDialog(frame, 'Enter a Stock Ticker', 'Text Entry')
dlg.SetValue("AMD")
if dlg.ShowModal() == wx.ID_OK:
# print('Ticker entered was: %s\n' % dlg.GetValue())
return dlg.GetValue()
dlg.Destroy()
def pickStrikePrice(choices):
class MyFrame(wx.Frame):
def __init__(self, parent, title):
super(MyFrame, self).__init__(parent, title=title, size=(400, 200))
self.panel = MyPanel(self)
class MyPanel(wx.Panel):
def __init__(self, parent):
super(MyPanel, self).__init__(parent)
self.label = wx.StaticText(
self, label="Pick a Strike Date:", pos=(50, 30))
languages = choices
self.combobox = wx.ComboBox(self, choices=languages, pos=(50, 50))
self.label2 = wx.StaticText(self, label="", pos=(50, 80))
self.Bind(wx.EVT_COMBOBOX, self.OnCombo)
def OnCombo(self, event):
self.label2.SetLabel("You picked " + self.combobox.GetValue())
global choice
choice = self.combobox.GetValue()
app.ExitMainLoop()
class MyApp(wx.App):
def OnInit(self):
self.frame = MyFrame(parent=None, title="Strike Picker")
self.frame.Show()
return True
app = MyApp()
app.MainLoop()
def returnChoice():
global choice
return choice