Home > other > The questions in the Tkinter controls
The questions in the Tkinter controls
Time:09-30
Below all controls are not centered, could you tell me how to modify the code to make them all center configuration?
import tkinter as tk
The class ReNamer (tk. Tk) : Def __init__ (self) : Super () __init__ () The self. The value=https://bbs.csdn.net/topics/0 Label_info=tk. Label (self, text="both Please select a folder:") Btn_select=tk. The Button (self, text="Click Me", width=8) Btn_check=tk. The Button (self, text="Check," width=8) Label_show=tk. Label (self, text={} "the file (s) renamed". The format (self. Value))
# opts={' ipadx: 10, 'ipady: 10,' padx: 10, 'pady: 10,' sticky ':' nswe} Label_info. The grid (row=0, the column=0, columnspan=2) Btn_select. The grid (row=1, the column=0) Btn_check. The grid (row=1, the column=2) Label_show. The grid (row=2, the column=0, columnspan=2)
If __name__=="__main__" : Root=ReNamer () Root. Mainloop ()
CodePudding user response:
Change the grid to pack?
The import tkinter as tk
The class ReNamer (tk. Tk) : Def __init__ (self) : Super () __init__ () The self. The value=https://bbs.csdn.net/topics/0 Label_info=tk. Label (self, text="both Please select a folder:") Btn_select=tk. The Button (self, text="Click Me", width=8) Btn_check=tk. The Button (self, text="Check," width=8) Label_show=tk. Label (self, text={} "the file (s) renamed". The format (self. Value))