- This topic has 2 replies, 1 voice, and was last updated Jun 18-5:19 pm by Brian Masinick.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Forum for users of antiX Linux. Mean and Lean and Proudly anti-fascist.
Tagged: "Python Clock Script"
I’m starting again at the site https://www.codeunderscored.com/make-digital-clock-python/ to copy and investigate a clock script written in Python.
--
Brian Masinick
I found multiple clock projects that may help a novice python program writer.
I was able to grab 3 examples, change the % variable to display time the way I prefer it and they all work.
--
Brian Masinick
# PyClock.py from https://www.codeunderscored.com/make-digital-clock-python/
# Copied by Brian Masinick on Saturday, June 18, 2022
# importing the entire tkinter module
from tkinter import *
from tkinter.ttk import *
# to retrieve the system's time, you need to import the strftime function
from time import strftime
# creation of the tkinter window
main = Tk()
main.title('The digital clock in Python')
# This function displays the current time on the label defined herein
def displayTime():
string = strftime('%r')
clock_label.config(text = string)
clock_label.after(1000, displayTime)
# creating an attractive look: needs styling the label widget
clock_label = Label(main, font = ('calibri', 42, 'bold'),
background = 'purple',
foreground = 'white')
# defining how to place the digital clock at the centre tkinter's window
clock_label.pack(anchor = 'center')
displayTime()
mainloop()
--
Brian Masinick
| Cookie | Duration | Description |
|---|---|---|
| cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
| cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
| cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
| cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
| cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
| viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |