en
Feedback
Python Tkinter

Python Tkinter

Open in Telegram
1 127
Subscribers
No data24 hours
No data7 days
No data30 days
Posts Archive
# Create window with background image from tkinter import * class StartWindow: def __init__(self, master): master.geometry('1
# Create window with background image from tkinter import * class StartWindow: def __init__(self, master): master.geometry('1024x720') # window size master.title("Window with background") master.image = PhotoImage(file='E:/pp/water.png') bg_label = Label(master, image=master.image) bg_label.grid(row=0, column=0) root = Tk() my_gui = StartWindow(root) root.mainloop()

A very useful book for those who study python and tkinter. There are many information about methods and their parameters.
For those who learn only tkinter there are useful information from 415 page.

# Create main window import tkinter top = tkinter.Tk() # Code to add widgets... top.mainloop()
# Create main window import tkinter top = tkinter.Tk() # Code to add widgets... top.mainloop()

~ What's Tkinter ~ Tkinter is the standard GUI library for Python. Creating a GUI application using Tkinter is an easy task. All you need to do is perform the following steps āˆ’ 1) Import the Tkinter module. 2) Create the GUI application main window. 3) Add one or more of the above-mentioned widgets to the GUI application. 4) Enter the main event loop to take action against each event triggered by the user.

If you have problem with " Wish.exe cannot be found while running page gui builder in python " Install Activetcl From https://www.activestate.com/products/activetcl/downloads/

For simple developming you can install page gui generator, from this link https://sourceforge.net/projects/page/

tutorial tkinter ^

GUI

Method pack() The manager handles all widgets that are packed inside the same master widget. The packing algorithm is simple, but a bit tricky to describe in words; imagine a sheet of some elastic material, with a very small rectangular hole in the middle. For each widget, in the order they are packed, the geometry manager makes the hole large enough to hold the widget, and then place it against a given inner edge (default is the top edge). It then repeats the process for all widgets. Finally, when all widgets have been packed into the hole, the manager calculates the bounding box for all widgets, makes the master widget large enough to hold all widgets, and moves them all to the master.