I am tying to make a login form using Python and GTK3 with the help of Anjuta. So far, I have a UI file for my login section, and a form that makes an HTTP request. The class looks like this:
class GUI:
def __init__(self):
self.builder = Gtk.Builder()
self.builder.add_from_file(UI_FILE)
self.builder.connect_signals(self)
window = self.builder.get_object('window')
window.set_title("LOGIN")
window.show_all()
self.username = ''
self.password = ''
When I fill in the correct data, the HTTP request is successful and I can see the response in the console. But what I want to do is clear the current window (UI file) and load a new one in its place. That is, without closing the actual window and opening up a new one. How do I do that?
Let's say you have this ui file
Now, you create you your window as usual:
If you want to change the content of the window. Then you need to destroy/hide the widget you want to hide.
And we're all good to go. You can load your second widget hierarchy (grid2, I mean) from the same initial ui file or from a new one. What you need to understand, is that after the Builder create the objects from the ui files, it can't modify those further.