Results 1 to 10 of 10
  1. #1
    lusciouslemons's Avatar
    Join Date
    Sep 2018
    Gender
    male
    Posts
    28
    Reputation
    10
    Thanks
    4
    My Mood
    Psychedelic

    how to create a clock in python

    i am new to python and wondering how to create a code for a clock for python

  2. #2
    r0llingthund3r's Avatar
    Join Date
    Sep 2015
    Gender
    male
    Posts
    17
    Reputation
    10
    Thanks
    7
    What kind of clock are you looking for. A line of text? An actual analog clock graphic?

  3. #3
    critikal17's Avatar
    Join Date
    Jul 2017
    Gender
    male
    Location
    Your bitch's house
    Posts
    251
    Reputation
    10
    Thanks
    55
    My Mood
    Daring

    Selling Bitcoin!
    15% Rate
    $1.15 Paypal for Every $1 BTC
    Click to add me on IM!

  4. #4
    wadhahb's Avatar
    Join Date
    Nov 2018
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    1
    You should probably just use an existing library, no need to reinvent the wheel!

  5. #5
    ooimooi's Avatar
    Join Date
    Nov 2018
    Gender
    male
    Location
    Murica
    Posts
    10
    Reputation
    10
    Thanks
    1
    Write out your algorithm in plain text on a notebook. Then Google how to convert each step to Python.

    This is literally what goes on. Over time you'll memorize more and more of each language you're using, but it's pointless to sit down and learn a programming language when you can't even write algorithms.

  6. #6
    LuNaRMarket's Avatar
    Join Date
    Aug 2018
    Gender
    male
    Posts
    312
    Reputation
    10
    Thanks
    54
    My Mood
    Cheeky
    Use stackoverflow it helps a lot as you have many users who have the same issues as you do usually.

  7. #7
    Hund.'s Avatar
    Join Date
    Nov 2018
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    a quick gui clock
    to speak easy, we are using a linux distro

    # install tkinter using terminal
    sudo apt install python-tk

    # make a text file and copy the text below, title file clock.py
    # run file in terminal using: python clock.py

    # import library
    import time
    import datetime
    # sudo apt install python-tk
    try:
    from tkinter import *
    except ImportError:
    from Tkinter import *

    # GUI root screen
    root = Tk()
    root.title('a clock')
    root.geometry('250x25+0+0')

    # get the clock time
    def getClock():
    start = time.time()
    clock = datetime.datetime.fromtimestamp(start).strftime('% H:%M:%S')
    label1 = Label(root, text=clock, font=("arial", 10,"bold"), fg="black").place(x=90,y=6)
    root.after(1000, getClock)

    root.after(1000, getClock)
    root.mainloop()

  8. #8
    bryv's Avatar
    Join Date
    Dec 2016
    Gender
    male
    Posts
    15
    Reputation
    10
    Thanks
    3
    thanks found that helpfiu

  9. #9
    critikal17's Avatar
    Join Date
    Jul 2017
    Gender
    male
    Location
    Your bitch's house
    Posts
    251
    Reputation
    10
    Thanks
    55
    My Mood
    Daring
    Quote Originally Posted by ooimooi View Post
    Write out your algorithm in plain text on a notebook. Then Google how to convert each step to Python.

    This is literally what goes on. Over time you'll memorize more and more of each language you're using, but it's pointless to sit down and learn a programming language when you can't even write algorithms.
    This is big facts. Programming syntax can come in go in your head but once you get in the algorithmic mindset, you can do ANYTHING

    Selling Bitcoin!
    15% Rate
    $1.15 Paypal for Every $1 BTC
    Click to add me on IM!

  10. #10
    venny26's Avatar
    Join Date
    Apr 2019
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Hi,

    I have a python codes which will you to create clock. Get the PC formatted string using time string time('%H:%M:%S').Recursive string check five time per second.
    Here is the coding part.
    # use Tkinter to show a digital clock
    # tested with Python24 vegaseat 10sep2006
    from Tkinter import *
    import time
    root = Tk()
    time1 = ''
    clock = Label(root, font=('times', 20, 'bold'), bg='green')
    clock.pack(fill=BOTH, expand=1)
    def tick():
    global time1
    # get the current local time from the PC
    time2 = time.strftime('%H:%M:%S')
    # if time string has changed, update it
    if time2 != time1:
    time1 = time2
    clock.config(text=time2)
    # calls itself every 200 milliseconds
    # to update the time display as needed
    # could use >200 ms, but display gets jerky
    clock.after(200, tick)
    tick()
    root.mainloop( )
    Thanks...

Similar Threads

  1. (TuT)How to create red dot (crosshair)
    By w00t? in forum Visual Basic Programming
    Replies: 10
    Last Post: 10-28-2007, 06:40 AM
  2. how to create open files..like "Lunch"
    By dor619 in forum Visual Basic Programming
    Replies: 10
    Last Post: 10-02-2007, 08:53 AM
  3. [help]how to create a bypass in vb?
    By warpebble2 in forum Visual Basic Programming
    Replies: 10
    Last Post: 09-25-2007, 07:45 AM
  4. Replies: 13
    Last Post: 02-09-2006, 10:25 PM
  5. how to create speedhacks?
    By LiLLeO in forum General Game Hacking
    Replies: 5
    Last Post: 01-28-2006, 08:52 AM