Hello: I have a few questions:
in the Gallery module widget appears ok to me - 640x480, After import I have a small window, I do not understand why?
How do I move this imported widget to the center of the main window? After import relative to the main window, it appears in the upper right corner. I tried this code fact it can be set but the problem is that here appears a second empty window and this empty one I can operate.
old_code.py
def get_gallery(self):
from GUI.module.gallery import Gallery
Gallery(tk.Toplevel(self.root)).pack(fill=tk.BOTH, expand=1)
x = self.root.winfo_x()
y = self.root.winfo_y()
tk.Toplevel(self.root).geometry("+%d+%d" % (x + 600, y + 800))
- How to make this imported window pasted into the main window after import? I.e. so that there are not two windows of the main window and the gallery (after import) but that they constitute one window? Thank you for your help :D
gallery.py
class Gallery(tk.Frame):
code of gallery
if __name__ == '__main__':
root.geometry("%dx%d" % (640, 480))
root.title("Open file")
app = Gallery(tk.Tk())
root.mainloop()
main.py
...
def get_gallery(self):
from GUI.module.gallery import Gallery
Gallery(tk.Toplevel(self.root)).pack()
def get_run_gallery(self):
jpg = tk.Button(self.frame, text="Gallery", command=self.get_gallery)
self.my_canvas.create_window(780, 220, anchor="nw", window=jpg, height=50, width=200)
...
def get_run_first_page():
calling ...
if __name__ == '__main__':
first = MainPage(tk.Tk())
first.get_run_first_page()