I have a question regarding window and button implementation. If I have a toolbar set up, and I have a button on it, is it possible to get it to open a window right within the program? I mean like open up a different section of the program much like the function, notepad1, would do? Or could I get it to imitate the behavior of what the system settings do, where it opens a window completely within the same window? If you can help, I appreciate it. I'm working with the default glade file if that helps anyone.
1 Answers
I'm doing this in my App also. I achieved it by doing something similar to the following:
In your main window get a reference to the widget you want to use as your parent. It must be a derivative of GtkContainer (such as GtkBox).
In my instance I did something like the following in my class constructor:
self.itemAsMyContainer = self.builder.get_object("name_of_object_id")
I then used glade to create another, separate ui file with a GtkContainer derivative such (in my case GtkBox) as its top level object, and then modified its Class name in a similar way to how quickly does it. I then created a separate class for it in a similar way to _lib/Window.py in the quickly template. Once that was done I could simply instantiate this new class and attach it to my referenced Container with a piece of code like:
self.my_sub_ui = MySexyGtkContainerSubClass()
self.itemAsMyContainer.pack_start(self.my_sub_ui)
I believe this same approach is possible with another window but you might have to unparent it. See this question for more info on that here