Use Tkinter to create GUI development tools (40) Really multiple sub-window design in Tkinter

Use Tkinter to create GUI development tools (40) The true multi-child window design
in Tkinter Why do we become the "true" multi-child window design in Tkinter, we introduced to you in the previous article "Using Tkinter to create GUI development tools (36) ) The multi-child window component in Tkinter"
https://blog.csdn.net/hepu8/article/details/106323782
is not a real child window. We use the event function to control the operation of multiple windows at the same time. It seems that there are sub-windows nested in the main window, then there is a problem. If the sub-window is larger than the main window, the sub-window will cover the main window and the sub-window will exceed the boundary of the main window.
In this video, we will introduce the true multi-child window design in Tkinter. The child window generated by this module is no different from ordinary development tools and windows child window applications. Because the child window is contained in the main window, it can never exceed the boundary of the main window.
This requires the use of the multi-window Tkinter module HP_mtk2. The demo code is directly given below.

import tkinter as tk
import HP_mtk2 as hmtk

root = hmtk.MainWindows(picture='img/bj2.jpg')
root.geometry('800x600+200+100')
root.title('主窗口') 

w1=root.newsubwin()
w2=root.newsubwin(title='是嵌套窗口2啊')
w3=root.newsubwin()

lb=tk.Label(w2,text='标签')
lb.pack(side=tk.TOP)
bt=tk.Button(w3,text='按钮')
bt.pack()
w1.geometry('200x100+10+10')
w2.geometry('200x100+440+300')
w3.geometry('200x100+400+400')

root.update()
root.mainloop()

Let's take a look at the results.
Insert picture description here
What else cannot be done with the Tkinter library that comes with Python?

#独狼荷蒲qq:2775205
#通通小白python quantitative group: 524949939
#电话微信:18578755056
#通通小白python quantitative group: 524949939
#tkinter,pyqt,gui,Python learning group: 647866213

Guess you like

Origin blog.csdn.net/hepu8/article/details/106592640