Re: Real time removal of toolitem
- From: Neil Munro <neilmunro gmail com>
- To: David NeÄas <yeti physics muni cz>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Real time removal of toolitem
- Date: Sat, 14 Jan 2012 13:24:02 +0000
Strange, I don't know why perhaps I had a typo I missed but it's
working now with a simple show/hide:
// Deal with terminal now, since it would just waste cpu cycles
dealing with it in a for loop
if( g_strrstr( sets->terminal, ":false" ) )
gtk_widget_hide( GTK_WIDGET( pd->tb_cmd ) );
else
gtk_widget_show( GTK_WIDGET( pd->tb_cmd ) );
Thanks though.
2012/1/14 David NeÄas <yeti physics muni cz>:
On Sat, Jan 14, 2012 at 12:34:10PM +0000, Neil Munro wrote:
   I was wondering if it is possible to remove a tool item from a
toolbar instantly,
=================================================
from gi.repository import Gtk
def modify(b, t):
 Âif t.get_n_items() == 1:
   Âb.set_stock_id(Gtk.STOCK_REMOVE)
   Âb2 = Gtk.ToolButton.new_from_stock(Gtk.STOCK_HELP)
   Âb2.show_all()
   Ât.insert(b2, 1)
 Âelse:
   Âb.set_stock_id(Gtk.STOCK_ADD)
   Ât.get_nth_item(1).destroy()
 Âprint t.get_n_items()
w = Gtk.Window()
w.connect('destroy', Gtk.main_quit)
w.set_default_size(200,40)
t = Gtk.Toolbar()
w.add(t)
b = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ADD)
b.connect('clicked', modify, t)
t.insert(b, 0)
w.show_all()
Gtk.main()
=================================================
I have tried
to destroy the widget but it still works, am I missing something
Yes. ÂHard to tell what.
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]