#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2017
    Posts
    43
    Rep Power
    1

    [Python 3.x + Tkinter] Clock not Work, Help Needed!


    Hey Python Programmers...

    I try to create an clock like program in python and tkinter... but the time don't update
    the seconds in my label... or reather, the seconds give still the same numbers on my
    label in tkinter and python 3.x...

    This is my script, written in pyScripter, Python 3.x...

    Code:
    from datetime import datetime
    from tkinter import *
    
    root = Tk()
    root.geometry('640x480')
    root.title('Clock')
    
    now = datetime.now()
    
    l = Label(root, text = int(now.second), foreground = 'white', background = 'black')
    l.pack(fill = X, side = TOP)
    
    root.mainloop()
    If you don't know about whats wrong... run my script and see whats happend in my
    clock.... the seconds (i get only seconds called in my code) get still the same time (or
    numbers are only the same numbers as you start my app)....

    Can anyone correct my code, just the time are updated in numbers like an digital clock...
    My time numbers don't leap further in seconds....

    Can anyone help me ?...., thanks for help,
    Jamie.
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Posts
    5,947
    Rep Power
    509
    Does this answer help? https://stackoverflow.com/questions/...e-after-method
    Where that program is to display a random character every 5 seconds you would instead display whatever part of the time that interests you.
    Use the datetime module in an interactive session until you figure out how to format the time in a most pleasing way.
    Also, please use much larger fonts. My eyesight is punk, my pixels many.

    font=('times', 40)
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo