-
Notifications
You must be signed in to change notification settings - Fork 0
/
pymorsegui1.py
167 lines (137 loc) · 5.95 KB
/
pymorsegui1.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.4 on Fri Jan 31 23:18:12 2020
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: MyDialog.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | wx.RESIZE_BORDER
wx.Dialog.__init__(self, *args, **kwds)
self.SetSize((561, 271))
self.text_ctrl_txt = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_NO_VSCROLL)
self.btnclear = wx.Button(self, wx.ID_ANY, "Clear")
self.btngenerate = wx.Button(self, wx.ID_ANY, "Generate")
self.btnplay = wx.Button(self, wx.ID_ANY, "Play")
self.btnopen = wx.Button(self, wx.ID_ANY, "Open")
self.btnsave = wx.Button(self, wx.ID_ANY, "Save")
self.btnexit = wx.Button(self, wx.ID_ANY, "Exit")
self.text_ctrl_morse = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_NO_VSCROLL)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.OnClear, self.btnclear)
self.Bind(wx.EVT_BUTTON, self.OnGenerate, self.btngenerate)
self.Bind(wx.EVT_BUTTON, self.OnPlay, self.btnplay)
self.Bind(wx.EVT_BUTTON, self.OnOpen, self.btnopen)
self.Bind(wx.EVT_BUTTON, self.OnSave, self.btnsave)
self.Bind(wx.EVT_BUTTON, self.OnExit, self.btnexit)
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyDialog.__set_properties
self.SetTitle("Morse Code Generator")
self.SetSize((561, 271))
self.text_ctrl_txt.SetToolTip("Enter the text to translate to morse code")
self.text_ctrl_txt.SetFocus()
self.text_ctrl_morse.SetToolTip("Morse Code will be generated in this text box")
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyDialog.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
label_1 = wx.StaticText(self, wx.ID_ANY, "Morse Code Generator", style=wx.ALIGN_CENTER)
label_1.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, ""))
sizer_2.Add(label_1, 0, wx.EXPAND, 0)
sizer_2.Add(self.text_ctrl_txt, 1, wx.ALL | wx.EXPAND, 10)
sizer_3.Add(self.btnclear, 0, 0, 0)
sizer_3.Add(self.btngenerate, 0, 0, 0)
sizer_3.Add(self.btnplay, 0, 0, 0)
sizer_3.Add(self.btnopen, 0, 0, 0)
sizer_3.Add(self.btnsave, 0, 0, 0)
sizer_3.Add(self.btnexit, 0, 0, 0)
sizer_2.Add(sizer_3, 0, wx.ALIGN_CENTER, 0)
sizer_2.Add(self.text_ctrl_morse, 1, wx.ALL | wx.EXPAND, 9)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
# end wxGlade
def OnClear(self, event): # wxGlade: MyDialog.<event_handler>
print("Event handler 'OnClear' not implemented!")
event.Skip()
def OnGenerate(self, event): # wxGlade: MyDialog.<event_handler>
print("Event handler 'OnGenerate' not implemented!")
event.Skip()
def OnPlay(self, event): # wxGlade: MyDialog.<event_handler>
print("Event handler 'OnPlay' not implemented!")
event.Skip()
def OnOpen(self, event): # wxGlade: MyDialog.<event_handler>
print("Event handler 'OnOpen' not implemented!")
event.Skip()
def OnSave(self, event): # wxGlade: MyDialog.<event_handler>
print("Event handler 'OnSave' not implemented!")
event.Skip()
def OnExit(self, event): # wxGlade: MyDialog.<event_handler>
print("Event handler 'OnExit' not implemented!")
event.Skip()
# end of class MyDialog
class MyMenuBar(wx.MenuBar):
def __init__(self, *args, **kwds):
# begin wxGlade: MyMenuBar.__init__
wx.MenuBar.__init__(self, *args, **kwds)
wxglade_tmp_menu = wx.Menu()
wxglade_tmp_menu.Append(1, "Open", "")
self.Bind(wx.EVT_MENU, self.onOpen, id=1)
wxglade_tmp_menu.Append(2, "Save", "")
self.Bind(wx.EVT_MENU, self.onSave, id=2)
wxglade_tmp_menu.AppendSeparator()
wxglade_tmp_menu.Append(3, "Generate", "")
self.Bind(wx.EVT_MENU, self.onGenerate, id=3)
wxglade_tmp_menu.Append(4, "Play", "")
self.Bind(wx.EVT_MENU, self.onPlay, id=4)
wxglade_tmp_menu.AppendSeparator()
wxglade_tmp_menu.Append(5, "Exit", "")
self.Bind(wx.EVT_MENU, self.onExit, id=5)
self.Append(wxglade_tmp_menu, "File")
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: MyMenuBar.__set_properties
pass
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyMenuBar.__do_layout
pass
# end wxGlade
def onOpen(self, event): # wxGlade: MyMenuBar.<event_handler>
print("Event handler 'onOpen' not implemented!")
event.Skip()
def onSave(self, event): # wxGlade: MyMenuBar.<event_handler>
print("Event handler 'onSave' not implemented!")
event.Skip()
def onGenerate(self, event): # wxGlade: MyMenuBar.<event_handler>
print("Event handler 'onGenerate' not implemented!")
event.Skip()
def onPlay(self, event): # wxGlade: MyMenuBar.<event_handler>
print("Event handler 'onPlay' not implemented!")
event.Skip()
def onExit(self, event): # wxGlade: MyMenuBar.<event_handler>
print("Event handler 'onExit' not implemented!")
event.Skip()
# end of class MyMenuBar
class MyApp(wx.App):
def OnInit(self):
self.dialog = MyDialog(None, wx.ID_ANY, "")
self.SetTopWindow(self.dialog)
self.dialog.ShowModal()
self.dialog.Destroy()
return True
# end of class MyApp
if __name__ == "__main__":
PyMorsecode = MyApp(0)
PyMorsecode.MainLoop()