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
|
# Pinpad
|
||||||
|
|
||||||
def win_pinpad():
|
class win_pinpad(tk.Toplevel):
|
||||||
|
def __init__(self, parent):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
def update_time():
|
def update_time():
|
||||||
string_time = strftime('%A, der %d.%m.%Y - %H:%M:%S')
|
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.config(text=string_time)
|
||||||
digital_clock.after(1000, update_time)
|
digital_clock.after(1000, update_time)
|
||||||
|
|
||||||
root = tk.Tk()
|
self.title(app_title + " " + app_version)
|
||||||
root.title(app_title + " " + app_version)
|
|
||||||
root.eval('tk::PlaceWindow . center')
|
|
||||||
|
|
||||||
# Digital clock label configuration
|
# 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)
|
digital_clock.grid(row=0, column=0, columnspan=3, padx=10, pady=10)
|
||||||
# Initial call to update_time function
|
# Initial call to update_time function
|
||||||
update_time()
|
update_time()
|
||||||
@ -37,10 +37,10 @@ def win_pinpad():
|
|||||||
buttons["OK"].configure(state="disabled")
|
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 = tk.StringVar()
|
||||||
UserNr.trace("w", lambda name, index, mode, UserNr=UserNr: usernr_changed(UserNr))
|
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)
|
usernr.grid(row=1,column=1)
|
||||||
|
|
||||||
# Pinpad
|
# Pinpad
|
||||||
@ -63,7 +63,7 @@ def win_pinpad():
|
|||||||
# Buttons definieren
|
# Buttons definieren
|
||||||
button_width = 7
|
button_width = 7
|
||||||
button_height = 3
|
button_height = 3
|
||||||
pinframe = tk.Frame(root)
|
pinframe = tk.Frame(self)
|
||||||
pinframe.grid(row=2, column=0, columnspan=3, padx=10, pady=10)
|
pinframe.grid(row=2, column=0, columnspan=3, padx=10, pady=10)
|
||||||
buttons = { }
|
buttons = { }
|
||||||
|
|
||||||
@ -84,9 +84,25 @@ def win_pinpad():
|
|||||||
|
|
||||||
usernr.focus_set()
|
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