From 45164d4dbadfa07df10d542e84e31195a485a4de Mon Sep 17 00:00:00 2001 From: pythonboi Date: Wed, 22 Feb 2023 17:45:19 -0500 Subject: [PATCH 1/2] fix the issue displaying the time on the screen and time changing on the screen --- Digital_Clock/clock.py | 44 ++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/Digital_Clock/clock.py b/Digital_Clock/clock.py index ec1a6bd..7df3f38 100644 --- a/Digital_Clock/clock.py +++ b/Digital_Clock/clock.py @@ -1,12 +1,14 @@ from tkinter import * -from tkinter import ttk -import tkinter as tk +# from tkinter import ttk +# import tkinter as tk from time import sleep from datetime import datetime root = Tk() +# myText = Label(root) + root.title("Digital Time") root.geometry("400x250") @@ -21,37 +23,21 @@ myClock.place(x=50, y=20) -# mytText = tk.Entry(root, justify="center", width=6, font=("poppins", 50, "bold"), bg="black", border=0, fg="red") -# mytText.place(x=85, y=70) -# mytText.focus() - - def timer(): - while True: - - getTime = datetime.now() - sleep(1) - myTextClock = getTime.strftime("%H:%M:%S") - # myText = Label(root, justify="center", width=6, font=("poppins", 45, "bold"), bg="black", border=0, - # fg="red") - # myText.place(x=85, y=75) + # while True: + getTime = datetime.now() + #sleep(1) + myTextClock = getTime.strftime("%H:%M:%S") - # return myText - - # print(getTime.strftime("%H:%M:%S")) - - myText = Label(root, justify="center", width=6, font=("poppins", 45, "bold"), bg="black", border=0, - fg="red") - myText.place(x=85, y=75) - myText.config(text=myTextClock) + myText = Label(root, justify="center", width=6, font=("poppins", 45, "bold"), bg="black", border=0, + fg="red") + myText.place(x=85, y=75) + # root.update(1000, timer) + root.after(1000, timer) + return myText.config(text=myTextClock) timer() -# myClock = Label(root) -# canvas = Canvas(root, width=400, height=250) -# canvas.pack() -# -# tm = canvas.create_rectangle(200, 200, 150, 150, bd) - +# root.after(1000, timer) root.mainloop() From 7a7cb1e638ca6682304ab701f87e2ae766f60220 Mon Sep 17 00:00:00 2001 From: pythonboi Date: Thu, 23 Feb 2023 10:59:18 -0500 Subject: [PATCH 2/2] Created a basic login windows using Tkinter --- LoginAccount.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 LoginAccount.py diff --git a/LoginAccount.py b/LoginAccount.py new file mode 100644 index 0000000..13a7388 --- /dev/null +++ b/LoginAccount.py @@ -0,0 +1,33 @@ +import secrets +from tkinter import * + +window = Tk() + +window.geometry("350x300") + +window.title("My Login") + +window.resizable(False, False) + +login = Label(window, justify="center", text="Login Window", fg="blue", font=("Candara", 20, "bold",)) +login.place(x=85, y=20) + +name = Label(window, text="Username:", font=("aria", 12, "bold")) +name.place(x=0, y=90) + +passwd = Label(window, text="Password:", font=("arial", 12, "bold")) +passwd.place(x=0, y=130) + +ntxt = Entry(window, width=40,) +ntxt.place(x=90, y=95) + +ptxt = Entry(window, width=40, show='*') +ptxt.place(x=90, y=135) + +lbtn = Button(window, text="Login", font=("Gabriola",), bg="green", width=10) +lbtn.place(x=200, y=200) + +pbtn = Button(window, text="Cancel", font=("Gabriola",), bg="yellow", width=10) +pbtn.place(x=100, y=200) + +window.mainloop()