The standard GUI (Graphical User Interface) package is called Tkinter. By default, its included with the Microsoft Windows and Mac OS X install of Python. It is sometimes called “one of the minor traditions of the Python world”.
![Python tkinter avanzado tutorial Python tkinter avanzado tutorial](/uploads/1/2/5/3/125369882/419561398.jpg)
Next Chapter:Tkinter Hello Tkinter LabelWe will start our tutorial with one of the easiest widgets of Tk (Tkinter), i.e. A label.A Label is a Tkinter Widget class, which is used to display text or an image. The label is a widgetthat the user just views but not interact with.There is hardly any book or introduction into a programming language, which doesn't start withthe 'Hello World' example. We will draw on tradition but will slightly modify the output to 'Hello Tkinter'instead of 'Hello World'.The following Python script uses Tkinter to create a window with the text 'Hello Tkinter'.
You can use thePython interpretor to type this script line after line, or you can save it in a file, for example, 'hello.py':import tkinter as tk# if you are still working under a Python 2 version,# comment out the previous line and uncomment the following line# import Tkinter as tkroot = tk.Tkw = tk.Label(root, text='Hello Tkinter!'
Tkinter is a Python standard library which is used to create GUI (Graphical User Interface) applications. It is one of the most commonly used package of Python. Tkinter supports both traditional and modern graphics support with the help of Tk themed widgets. All the widgets that tkinter has also available in tkinter.ttk.Adding style in a tkinter.ttk button is little bit creepy because it doesn’t support direct implementation.
![Python Python](/uploads/1/2/5/3/125369882/196141360.jpg)
To add styling in a ttk.Button we have to first create a object of style class which is available in tkinter.ttk.We can create ttk.Button by using following steps: btn = ttk.Button(master, option = value.)ttk.Button options –command: A function to be called when button is pressed.text: Text which appears on the Button.image: Image to be apper on the Button.style: Style to be used in rendering this button.To add styling on the ttk.Button we cannot directly pass the value in the options. Firstly, we have to create a Style object which can be created as follows: style = ttk.StyleBelow code will be adding style to only selected Buttons i.e, only those buttons will get changed in which we will be passing style option.Code #1.