Click here to Skip to main content
15,748,088 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am trying to set date and time on my window 1. I don't know how to do that. Can anyone please help me.

What I have tried:

from tkinter import *
import tkinter as tk
from tkinter import messagebox
import serial

class Win1(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        Label(self, text= "ISMC", font= ('Helvetica 20 bold')).pack(padx=300, pady=5)
        B1=Button(self, text="AUTO", command=lambda:controller.show_frame(Win2)).pack(pady=20, padx=200)
        B2=Button(self, text="MANUAL", command=lambda:controller.show_frame(Win4)).pack(pady=20, padx=200)

class Win2(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

class Application(tk.Tk):
     def __init__(self, *args, **kwargs):
         tk.Tk.__init__(self, *args, **kwargs)
         window = tk.Frame(self)
         window.pack(side = "top", fill = "both", expand = True)
         self.frames = {}
         for F in (Win1, Win2):
             frame = F(window, self)
             self.frames[F] = frame
             frame.grid(row = 0, column=0, sticky="nsew")
    def show_frame(self, window):
        frame = self.frames[window]
        self.title("Relay Test") 
app = Application()
Updated 16-Feb-23 22:49pm

1 solution

Share this answer
Richard MacCutchan 17-Feb-23 5:00am    
No, for two reasons:
1. Implementation is your job, we are here to help and advise, not to do the work.
2. I have no idea what your code is supposed to do, what information you want to display, or where you want to display it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900