Pin Pad in Klasse überführt
This commit is contained in:
parent
0a39ee7f17
commit
b2ede4d5a4
Binary file not shown.
BIN
__pycache__/users.cpython-311.pyc
Normal file
BIN
__pycache__/users.cpython-311.pyc
Normal file
Binary file not shown.
38
ui.py
38
ui.py
@ -10,7 +10,9 @@ from definitions import app_title, app_version
|
||||
|
||||
# Pinpad
|
||||
|
||||
def win_pinpad():
|
||||
class win_pinpad(tk.Toplevel):
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
|
||||
def update_time():
|
||||
string_time = strftime('%A, der %d.%m.%Y - %H:%M:%S')
|
||||
@ -18,12 +20,10 @@ def win_pinpad():
|
||||
digital_clock.config(text=string_time)
|
||||
digital_clock.after(1000, update_time)
|
||||
|
||||
root = tk.Tk()
|
||||
root.title(app_title + " " + app_version)
|
||||
root.eval('tk::PlaceWindow . center')
|
||||
self.title(app_title + " " + app_version)
|
||||
|
||||
# Digital clock label configuration
|
||||
digital_clock = tk.Label(root)
|
||||
digital_clock = tk.Label(self)
|
||||
digital_clock.grid(row=0, column=0, columnspan=3, padx=10, pady=10)
|
||||
# Initial call to update_time function
|
||||
update_time()
|
||||
@ -37,10 +37,10 @@ def win_pinpad():
|
||||
buttons["OK"].configure(state="disabled")
|
||||
|
||||
|
||||
tk.Label(root, text="Benutzernummer:").grid(row=1, column=0)
|
||||
tk.Label(self, text="Benutzernummer:").grid(row=1, column=0)
|
||||
UserNr = tk.StringVar()
|
||||
UserNr.trace("w", lambda name, index, mode, UserNr=UserNr: usernr_changed(UserNr))
|
||||
usernr = tk.Entry(root, width=10, textvariable=UserNr)
|
||||
usernr = tk.Entry(self, width=10, textvariable=UserNr)
|
||||
usernr.grid(row=1,column=1)
|
||||
|
||||
# Pinpad
|
||||
@ -63,7 +63,7 @@ def win_pinpad():
|
||||
# Buttons definieren
|
||||
button_width = 7
|
||||
button_height = 3
|
||||
pinframe = tk.Frame(root)
|
||||
pinframe = tk.Frame(self)
|
||||
pinframe.grid(row=2, column=0, columnspan=3, padx=10, pady=10)
|
||||
buttons = { }
|
||||
|
||||
@ -84,9 +84,25 @@ def win_pinpad():
|
||||
|
||||
usernr.focus_set()
|
||||
|
||||
# Tkinter main loop
|
||||
class mainwindow(tk.Tk):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
root.mainloop()
|
||||
self.geometry('300x200')
|
||||
self.title('Main Window')
|
||||
|
||||
# place a button on the root window
|
||||
tk.Button(self,
|
||||
text='Login Window',
|
||||
command=self.open_window).pack(expand=True)
|
||||
|
||||
def open_window(self):
|
||||
window = win_pinpad(self)
|
||||
window.grab_set()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = mainwindow()
|
||||
app.mainloop()
|
||||
|
||||
def win_userselection():
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user