I am trying to open a second window in the center of the main window. It needs to work where ever the main window is located and for what ever the main window's size is. I have set up some some test widget to make sure that when the second window is close it enables all the main windows functionality.
What I'm using.
- Windows 10
- Python 3.7.9
- Guizero 1.2.0/tkinter
- Thonny 3.3.10 ide
Example of what I'm trying to do.
My code.
from guizero import *
app = App(bg='#121212',title='Main window',width=575,height=550)
app.tk.resizable(False, False)
def SecondWindow_closed():
secondWindow.destroy()
app.enable()
app.focus()
def System_secondWindow():
global secondWindow
secondWindow = Window(app,bg='#121212',title='Settings window',width=355,height=425)
secondWindow.tk.resizable(False, False)
About_project=Text(secondWindow,text='About this project ',align='bottom')
About_project.text_color='white'
secondWindow.tk.grab_set()
secondWindow.when_closed=SecondWindow_closed
Settings_button = PushButton(app, text='Settings ⚙',command=System_secondWindow)
Settings_button.text_color='white'
Test_widget=TextBox(app,)
Test_widget.bg='white'
app.display()
This code creates a new window that is in the center of the old one. The problem is that it uses pure
tkinter
instead ofguizero
.Updated for guizero