Mar-15-2017, 07:04 AM
Hi,
here is what I am trying to do:
I would like to have a window (let's call it
Also in the window there is to be a button. Upon clicking this button a new window (
These entry fields can be used to input new values. And upon clicking the button the
Stackoverflow provided me with a code example on how to create the windows (using an instance of two seperate classes), so that isn't really the problem... but I am rather confused as to how to get the values from the instance of
So now on to the second problem:
Is it possible to dynamicall grow a window? The idea is to dynamicall add new frames to the
The idea is somewhat like describing the different stages of a long journey.
Every stage has a start and a finish. And these values get displayed in their own frame.
Is it possible to dynamically add these new frames into the existing window?
here is what I am trying to do:
I would like to have a window (let's call it
MainWindow
) displaying some information (namely a String and four numbers each on their own Label).Also in the window there is to be a button. Upon clicking this button a new window (
ConfigWindow
) is to open up, with a few entry fields and another button (corresponding to the values in MainWindow
).These entry fields can be used to input new values. And upon clicking the button the
ConfigWindow
closes and the values are passed on to the MainWindow
where they are displayed. Basically updating the values in MainWindow
by means of a secondary window.Stackoverflow provided me with a code example on how to create the windows (using an instance of two seperate classes), so that isn't really the problem... but I am rather confused as to how to get the values from the instance of
ConfigWindow
into that of MainWindow
.from tkinter import * class MainWindow: def __init__(self, master): self.master = master self.frame = Frame(self.master) self.button1 = Button(self.frame, text = 'New Window', width = 25, command = self.new_window) self.button1.pack() self.frame.pack() def new_window(self): self.newWindow = Toplevel(self.master) self.app = Demo2(self.newWindow) class InfoCfg: def __init__(self, master): self.master = master self.frame = Frame(self.master) self.quitButton = Button(self.frame, text = 'Quit', width = 25, command = self.close_windows) self.quitButton.pack() self.frame.pack() def close_windows(self): self.master.destroy()
Is it possible to dynamicall grow a window? The idea is to dynamicall add new frames to the
MainWindow
.The idea is somewhat like describing the different stages of a long journey.
Every stage has a start and a finish. And these values get displayed in their own frame.
Is it possible to dynamically add these new frames into the existing window?