We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cbe16aa commit 181b0deCopy full SHA for 181b0de
Simple-Clock-Gui/clock.py
@@ -0,0 +1,21 @@
1
+from tkinter import * # import everything from tkinter module
2
+from time import strftime # import strftime from time module for getting the time
3
+
4
+root = Tk() # create a GUI with tkinter
5
+root.title('Clock_Python') # title of the window
6
+lbl = Label(root, font = ('callibri', 45, 'bold'), #specify the font, font size, and others like bold,italics,underlined,etc..
7
+ background = 'black', # background color
8
+ foreground = 'white') # foreground color
9
10
+def time(): # call this function to display the time
11
+ string = strftime('%H:%M:%S %p') # specify the format of the time
12
+ lbl.config(text = string) # get the time in the specified format
13
+ lbl.after(1000, time)
14
15
16
+lbl.pack(anchor = 'center') # centre align the text
17
+time() # show the time
18
19
+mainloop() # loop the program
20
21
+# now you can make it a standalone desktop app (.exe) with pyinstaller or auto-py-to-exe
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments