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

    Join Date
    Mar 2017
    Rep Power

    Question set time & date by user in tkinter

    how can a user set time & date in a tkinter window...please give me a link...i searched but i didn't find a suitable content... i am looking for a general code regardless what is my code?
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power
    All my (USA) devices set time via the internet without my intervention.
    Anyway, there are two issues here. How to use tkinter and how to set time.
    Usually python supplies functionality that removes operating system dependence. I didn't find anything for setting time, which depends on operating system.
    In DOS as I recall the command line programs date and time work similarly. Without switches they print the current value then ask for new value. Pressing the Enter key leaves the values unchanged.
    With linux the super user (root) would issue date --set='new time' .
    You can determine the operating system with standard library platform.system()
    Then you'd execute the command using perhaps https://docs.python.org/3/library/su...cing-os-system
    In DOS I presume the command would be 'date < file_containing_new_date'
    In linux you'd run the python program as super user and issue "date --set='new time string'" .

    Sufficient? Do you also need tkinter code?

    PS, setting time wrong screws up the order of files. Can be tempting to set the time into the past in order to get a little more use out of a license or something. Bad idea, possibly illegal. Don't do it.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo