Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python with tkinter this program should be able to open from displaytimeanddate() and show the time and the date. it should then have a button
python with tkinter this program should be able to open from displaytimeanddate() and show the time and the date. it should then have a button that takes it to displaytime() that just shows the current time. i seem to be really struggling with showing the actual outputs but i can get Current_date() and Current_time() to update sucsessfully on the same page only if i have them in the same class.
import tkinter as tk import time class Current_time(): def __init__(self): self.clock = tk.Label(text="", font=('Helvetica', 48), fg='black', background='black') self.clock.pack() self.reuptime() def reuptime(self): current_time = time.strftime("%I:%M:%S") self.clock.configure(text=current_time) self.root.after(1000, self.reuptime) class Current_date(): def __init__(self): self.date = tk.Label(text="", font=('Helvetica', 48), fg='black', background='black') self.date.pack() self.reupday() def reupday(self): current_date = time.strftime("%x") self.date.configure(text=current_date) self.root.after(100000, self.reupday) class displaytimeanddate(): def __init__(self): self.root.resizable(0, 0) self.root.configure(bg='white') self.root.clock() self.button = tk.Button(self.root, text='just display time', width=25, command=self.root.displaytime) self.root.clock self.root.Current_date() self.root.mainloop() class displaytime(): def __init__(self): self.root.resizable(0, 0) self.root.configure(bg='white') self.root.clock() self.button = tk.Button(self.root, text=' display time and date', width=25, command=self.root.displaytime) self.root.clock self.root.mainloop() displaytimeanddate()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started