به درخواست کاربران مبنی بر انتشار سورس پروژه پایتون ، سعی میکنیم در این مدت سورس های بیشتر از این زبان برنامه نویسی داخل سایت قرار بدیم در این لحظه سورس ساعت دیجیتال ساده با پایتون را آماده کردیم ، پروژه ساعت دیجیتال با زبان برنامه نویسی پایتون به صورت ساده اما در عین حال کاربردی کدنویسی شده است. از این سورس کد میتوانید در سایر پروژه های پایتون خود استفاده کنید. همچنین میتوانید با بررسی کدها، سطح برنامه نویسی خود را ارتقا دهید.
قسمتی از سورس کد ساعت دیجیتال ساده با پایتون
from tkinter import * import time root = Tk() root.title("sourcesoft") width = 600 height = 400 screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() x = (screen_width/2)- (width/2) y = (screen_height/2) - (height/2) root.geometry("%dx%d+%d+%d" % (width, height, x, y)) root.resizable(0, 0) root.config(bg="light blue") #===========================================METHODS======================================= def tick(): setTime = time.strftime('%I: %M %S %p') clock.config(text=setTime ) clock.after(200, tick) #===========================================FRAMES======================================== Top = Frame(root, width=600, bd=1, relief=SOLID) Top.pack(side=TOP) Mid = Frame(root, width=600) Mid.pack(side=TOP, expand=1) #===========================================LABEL WIDGET================================== lbl_title = Label(Top, text="Python: Simple Digital Clock", width=600, font=("arial", 20)) lbl_title.pack(fill=X) clock = Label(Mid, font=('times', 50 , 'bold'), fg="green", bg="light blue") clock.pack() /> sourceiran.com
دیدگاه کاربران
تعداد دیدگاه های کاربران : ۰ دیدگاه