Re: Using Fileselection, changing or updating labels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 21 May 2008, Sandra Derbring wrote:
>
> 1. Can I change the label of a checkbutton or a radiobutton after I have
> created it? I can't seem to find a set_label function for this. Is there
> any other way?
>
There should be a set_label function, as it's provided by the grandparent 
GtkButton widget. I get the feeling you're using Python bindings? Fine choice 
of language, but not a set of GTK bindings I'm familiar with (I mostly use 
GTKmm).

> 2. From my main program, I created a file menu that opens a file selection
> box. The fileselection is in an own file and called by with:
> o.FileSelection(). When I press "Cancel" on the file selection box that
> appears, it doesn't just close itself, but the whole program. How can I
> prevent this? I only want to close the box and return to the main window.
>
> self.filew.cancel_button.connect("clicked",lambda w: self.filew.destroy())
>
> def destroy(self, widget):
> gtk.main_quit()
>
Well, you most certainly don't want to hook up anything with a gtk.main_quit() 
call, because that will close your application. Just because the file 
selection code sits in its own module doesn't make it a different GTK 
instance. What you should do, and probably in the file selection module not 
the main program, is connect a simple "hide" call to the cancel button. For 
example:

class MyFileWidget :
   def Setup ( self, other args ) :
       <do stuff>
       self.cancel_button.connect("clicked",lambda w: self.give_up())

   def give_up ( self, widget ) :
       self.hide()

You don't actually need to destroy the file selector - you could keep it 
around for later, or allow the instance to be deleted by Python by going out 
of scope.


I don't have answers for the other two questions right now, sorry.

Rob


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux