-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.py
46 lines (33 loc) · 1.42 KB
/
1.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
from kivy.uix.widget import Widget
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.image import Image
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
class Morse_Translator(Widget):
pass
class MorseApp(App):
def build(self):
self.window = GridLayout()
self.window.cols = 2
self.window.rows = 3
self.add_text =Label(text="Please enter the text in morse:")
self.window.add_widget(self.add_text)
self.user = TextInput(multiline=True)
self.window.add_widget(self.user)
self.button = Button(text="Translate!")
self.button.bind(on_press=self.callback)
self.window.add_widget(self.button)
def callback(self, instance):
self.add_text.text = "HI i should add the morse translating logic here"
return self.window
if __name__ == '__main__':
MorseApp().run()
morse_alphabet = {".-": "a", "-...": "b", "-.-.": "c", "-..": "d", ".": "e",
"..-.": "f", "--.": "g", "....": "h", "..": "i", ".---": "j",
"-.-": "k", ".-..": "l", "--": "m", "-.": "n", "---": "o",
".--.": "p", "--.-": "q", ".-.": "r", "...": "s", "-": "t",
"..-": "u", "...-": "v", ".--": "w", "-..-": "x", "-.--": "y", "--..": "z"}
from kivy.uix.textinput import TextInput
textinput = TextInput(text='Hello world')