Note that there are some explanatory texts on larger screens.

plurals
  1. POpyGTK Radio Button
    primarykey
    data
    text
    <p>Alright, I'll preface this with the fact that I'm a GTK <em>and</em> Python newb, but I haven't been able to dig up the information I needed. Basically what I have is a list of Radio Buttons, and based on which one is checked, I need to connect a button to a different function. I tried creating all my radio buttons, and then creating a disgusting if/else block checking for <code>sget_active()</code> on each button. The problem is the same button returns true every single time. Any ideas?</p> <p>Here's the code in use:</p> <pre><code> #Radio Buttons Center self.updatePostRadioVBox = gtk.VBox(False, 0) self.updatePageRadio = gtk.RadioButton(None, "Updating Page") self.updatePostRadio = gtk.RadioButton(self.updatePageRadio, "Updating Blog Post") self.pageRadio = gtk.RadioButton(self.updatePageRadio, "New Page") self.blogRadio = gtk.RadioButton(self.updatePageRadio, "New Blog Post") self.addSpaceRadio = gtk.RadioButton(self.updatePageRadio, "Add New Space") self.removePageRadio = gtk.RadioButton(self.updatePageRadio, "Remove Page") self.removePostRadio = gtk.RadioButton(self.updatePageRadio, "Remove Blog Post") self.removeSpaceRadio = gtk.RadioButton(self.updatePageRadio, "Remove Space") #Now the buttons to direct us from here self.returnMainMenuButton = gtk.Button(" Main Menu ") self.returnMainMenuButton.connect("clicked", self.transToMain) self.contentManageHBoxBottom.pack_start(self.returnMainMenuButton, False, False, 30) self.contentProceedButton = gtk.Button(" Proceed ") self.contentManageHBoxBottom.pack_end(self.contentProceedButton, False, False, 30) if self.updatePageRadio.get_active(): self.contentProceedButton.connect("clicked", self.updatePage) elif self.updatePostRadio.get_active(): self.contentProceedButton.connect("clicked", self.updatePost) elif self.pageRadio.get_active(): self.contentProceedButton.connect("clicked", self.newPage) elif self.blogRadio.get_active(): self.contentProceedButton.connect("clicked", self.newBlogPost) elif self.addSpaceRadio.get_active(): self.contentProceedButton.connect("clicked", self.newSpace) elif self.removePageRadio.get_active(): self.contentProceedButton.connect("clicked", self.removePage) elif self.removePostRadio.get_active(): self.contentProceedButton.connect("clicked", self.removeBlogPost) elif self.removeSpaceRadio.get_active(): self.contentProceedButton.connect("clicked", self.removeSpace) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload