top of page

Mini Dragon Group (ages 6-7)

公開·9名のメンバー
Andrew Stewart
Andrew Stewart

An Introduction To Tkinter



We have previously seen how to write text-only programs which have a command-line interface, or CLI. Now we will briefly look at creating a program with a graphical user interface, or GUI. In this chapter we will use tkinter, a module in the Python standard library which serves as an interface to Tk, a simple toolkit. There are many other toolkits available, but they often vary across platforms. If you learn the basics of tkinter, you should see many similarities should you try to use a different toolkit.




An Introduction to Tkinter



The GUI in the previous example has a relatively simple layout: we arranged the three widgets in a single column inside the window. To do this, we used the pack method, which is one of the three different geometry managers available in tkinter. We have to use one of the available geometry managers to specify a position for each of our widgets, otherwise the widget will not appear in our window.


These programs do not attempt to provide a comprehensiveintroduction to all aspects of Tkinter programming. For that, Irefer you to Frederik Lundh's An Introduction toTkinter, John Shipman's Tkinterreference, and the other useful references at the bottom ofthis page.


The tkinter.ttk module gives the user access to the Tkinter widget set and allows the user to import Combobox. A combobox is a graphical user interface element that merges a drop-down box, list box, and allows the user to select input.


In this video, we begin discussion of the tkinter module. The tkinter module is a wrapper around tk, which is a wrapper around tcl, which is what is used to create windows and graphical user interfaces. Here, we show how simple it is to create a very basic window in just 8 lines. We get a window that we can resize, minimize, maximize, and close! The tkinter module's purpose is to generate GUIs. Python is not very popularly used for this purpose, but it is more than capable of doing it.


On top of this, I also introduced myself to a new Widget in tkinter's arsenal: the radiobutton. I'm excited to use the framework I've lain out in this sample code to build out a simple countdown application as a future project! 041b061a72


グループについて

Welcome to the group! You can connect with other members, ge...

メンバー

bottom of page