-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI2.py
More file actions
100 lines (75 loc) · 2.94 KB
/
Copy pathUI2.py
File metadata and controls
100 lines (75 loc) · 2.94 KB
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
# import tkinter as tk
# import Recorder as recorder
# from tkinter import messagebox
# recording = recorder.Recorder().getRecordingStatus
# def button_click(e):
# global recording
# if not recording:
# label.config(text="Press the Button to Record")
# recording = False
# recorder.Recorder().setRecordingStatus(False)
# canvas.itemconfig(button_shape, fill="red")
# else:
# label.config(text="Recording...")
# recording = True
# recorder.Recorder().setRecordingStatus(True)
# recorder.Recorder().RecordAndConvertToText()
# canvas.itemconfig(button_shape, fill="blue")
# root = tk.Tk()
# root.title("App UI")
# label = tk.Label(root, text="Press the Button to Record")
# label.pack()
# canvas = tk.Canvas(root, width=50, height=50)
# canvas.pack()
# button_shape = canvas.create_oval(5, 5, 45, 45, fill="red")
# canvas.tag_bind(button_shape, "<Button-1>", button_click)
# root.mainloop()
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
class MainScreen(Screen):
def __init__(self, **kwargs):
super(MainScreen, self).__init__(**kwargs)
layout = BoxLayout(orientation='vertical')
self.status_label = Label(text='Idle')
record_button = Button(text='Start Recording')
record_button.bind(on_press=self.start_recording)
stop_button = Button(text='Stop Recording')
stop_button.bind(on_press=self.stop_recording)
notes_button = Button(text='Open Notes')
notes_button.bind(on_press=self.open_notes)
layout.add_widget(self.status_label)
layout.add_widget(record_button)
layout.add_widget(stop_button)
layout.add_widget(notes_button)
self.add_widget(layout)
def start_recording(self, instance):
# Placeholder for start recording logic
self.status_label.text = 'Recording...'
def stop_recording(self, instance):
# Placeholder for stop recording logic
self.status_label.text = 'Idle'
def open_notes(self, instance):
self.manager.current = 'notes_screen'
class NotesScreen(Screen):
def __init__(self, **kwargs):
super(NotesScreen, self).__init__(**kwargs)
layout = BoxLayout(orientation='vertical')
notes_label = Label(text='Notes')
back_button = Button(text='Back to Main Screen')
back_button.bind(on_press=self.go_back)
layout.add_widget(notes_label)
layout.add_widget(back_button)
self.add_widget(layout)
def go_back(self, instance):
self.manager.current = 'main_screen'
class LectureApp(App):
def build(self):
sm = ScreenManager()
sm.add_widget(MainScreen(name='main_screen'))
sm.add_widget(NotesScreen(name='notes_screen'))
return sm
if __name__ == '__main__':
LectureApp().run()