-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg.py
More file actions
31 lines (22 loc) · 1.37 KB
/
msg.py
File metadata and controls
31 lines (22 loc) · 1.37 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
from tkinter import *
class AskQuestion(Toplevel): # Diese Klasse erbt von "Toplevel" somit wird dies ein Popup Fenster obendrauf auf dem root Fenster
def __init__(self, root_class):
super().__init__()
self.title("Operation")
self.resizable(False, False)
# Innherlab des Popup Fensters
pop_label = Label(self, text="Save in the Database or as CSV file?")
pop_label.pack(pady=10)
frame = Frame(self)
frame.pack(pady=10)
button_db = Button(frame, text="Save in Database", command=lambda: choice(1)) # Um Parameter und Funktionen mittels einem Button zu übertragen, muss Lambda verwendet werde
button_db.grid(row=0, column=0, padx=10, pady=10)
button_csv = Button(frame, text="Save as CSV", command=lambda: choice(2))
button_csv.grid(row=0, column=1, padx=10, pady=10)
def choice(i): # Funktionen müssen in der individuellen "Root" Klasse gleich bezeichnet werden
if i == 1:
root_class.submit_db()
root_class.setPop()
elif i == 2:
root_class.submit_csv()
root_class.setPop()