Cải thiện bài viết
Lưu bài viết
Cải thiện bài viết
Lưu bài viết
Đọc
Tkinter : Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to
create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit. It’s very easy to get started with Tkinter, here are some sample codes to get your hands on Tkinter in python.
Python3
Bàn luận
Bài viết này tập trung vào việc tạo một chiếc đồng hồ bấm giờ bằng Tkinter trong Python & NBSP; Tkinter: Tkinter là thư viện GUI tiêu chuẩn cho Python. Python khi kết hợp với Tkinter cung cấp một cách nhanh chóng và dễ dàng để tạo các ứng dụng GUI. Tkinter cung cấp một giao diện hướng đối tượng mạnh mẽ cho bộ công cụ GUI TK. Nó rất dễ bắt đầu với Tkinter, đây là một số mã mẫu để có được Tkinter trong Python. & NBSP; & NBSP;
top.mainloop()
Output:
import tkinter
top = tkinter.Tk()
A stopwatch is a handheld timepiece designed to measure the amount of time elapsed from a particular time when
it is activated to the time when the piece is deactivated. A large digital version of a stopwatch designed for viewing at a distance, as in a sports stadium, is called a stop clock. In manual timing, the clock is started and stopped by a person pressing a button. In fully automatic time, both starting and stopping are triggered automatically, by sensors.
Required Modules: We are only going to use Tkinter for creating GUI and no other libraries will be used in this
program.
Source Code:
Python3
Tạo đồng hồ bấm giờ bằng tkinter
Bây giờ chúng ta hãy cố gắng tạo một chương trình bằng mô -đun Tkinter để tạo đồng hồ bấm giờ. & NBSP; Đồng hồ bấm giờ là đồng hồ cầm tay được thiết kế để đo lượng thời gian trôi qua từ một thời điểm cụ thể khi nó được kích hoạt đến thời điểm mà mảnh bị hủy kích hoạt. Một phiên bản kỹ thuật số lớn của đồng hồ bấm giờ được thiết kế để xem từ xa, như trong một sân vận động thể thao, được gọi là đồng hồ dừng. Trong thời gian thủ công, đồng hồ được bắt đầu và dừng lại bởi một người nhấn nút. Trong thời gian hoàn toàn tự động, cả bắt đầu và dừng đều được kích hoạt tự động, bởi các cảm biến. & NBSP; Các mô -đun bắt buộc: Chúng tôi sẽ chỉ sử dụng tkinter để tạo GUI và không có thư viện nào khác được sử dụng trong chương trình này. Mã nguồn này: & nbsp; & nbsp;
import tkinter as Tkinter
from datetime import tkinter1
tkinter2= tkinter4
tkinter5= tkinter7
tkinter8 tkinter9
top 0tkinter8 top 2
top 3top 4 top 5
=6=7==9
top 6tkinter.Tk()1tkinter.Tk()2
top 6top 7 top 8
top 6top 4 top 8==tkinter4=5
=6=7=top.mainloop()6
top 6top.mainloop()8top.mainloop()9import0=import2
top 6import4import5import6
=6tkinter.Tk()4= tkinter.Tk()6
top 0tkinter as Tkinter3
=6tkinter.Tk()8= top.mainloop()0top.mainloop()1top.mainloop()2
top 6tkinter2import9= tkinter as Tkinter1
top 0tkinter as Tkinter8=from2
top 0from4
top 0from6from7import0=datetime 0
top 0datetime 2from7import0=datetime 6
top 0datetime 8from7import0=datetime 6
tkinter8 tkinter as Tkinter5
top 6tkinter2import9= tkinter as Tkinter1
top 0from6from7import0=datetime 6
top 0datetime 2from7import0=datetime 0
top 0datetime 8from7import0=datetime 6
tkinter8 tkinter as Tkinter5
top 0top 7 tkinter as Tkinter8
tkinter8 tkinter04
top 0top 8=tkinter4
top 0tkinter5= tkinter7
tkinter8 tkinter31
top 3top.mainloop()8top.mainloop()9import0=tkinter57
top 0tkinter.Tk()1tkinter60
top 3top.mainloop()8top.mainloop()9import0=tkinter66
top 0top 7 top 8
tkinter70tkinter71top.mainloop()2
tkinter73=tkinter75tkinter76=tkinter78top.mainloop()2
top 0____24 tkinter as Tkinter8==tkinter7tkinter45
tkinter92
top 3datetime 8from7import0=datetime 0
tkinter67= tkinter69
Is
tkinter93= tkinter95
Các
top 08= tkinter98=______21212
top 48=top 46top.mainloop()2
top 52=top 46top.mainloop()2
top 56
Output:
//media.geeksforgeeks.org/wp-content/uploads/2017-10-26-at-19-18-25.mp4
CácSubhajit Saha. If you like GeeksforGeeks and would like to contribute,
you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.