简体   繁体   中英

How to open a new window in python pygtk after clicking a button

I'd like to know how to open a new window after clicking a button on current window.

I tried creating a list of objects of gtk.Window()

It gave me indexing error.

Well, I'm just at the beginning of working in pygtk too.

But, if you have other gtk.Window() in other file you have to do is like this:

btn.connect("clicked", self.onbtn1_clicked) #this is to connect to a function

Then you create a function like:

def onbtn1_clicked(self, widget):
       from yourscritp import classgtkwindow
       var1 = classgtkwindow()
       var1.show()

PS: Sorry for my bad English

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM