Re: [pygtk] I must be missing something - can't get label of a menu item
On Fri, Oct 15, 2004 at 11:04:39PM +0100, Gustavo J. A. M. Carneiro wrote: > > Johan's suggested the FAQ, and that's full of warnings that should be > > heeded. One alternative which I use daily is, instead of relying on the > > label, doing a set_data() on the menuitems as you put them into the > > menu, and then using get_data() to grab it back. I can get example code > > if that's not clear enough. > > > > There's one catch -- you can't use None given get_data() returns None by > > default; just use a ValueUnset dummy class to work around that, though. > > Actually, I think the only clean solution is to use > gtk.OptionMenu.get_history(), as index to a list of strings, or whatever > you want associated with each option. Hmmm. What's wrong with the get_data() approach I outlined? It frees you from using strings and shared data structures, at least. Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Re: glade and new gtk+ actions
On Mon, 18 Oct 2004 11:50:12 +0100, Stephen Kennedy wrote: > > Is anybody using the new UIManager/Actions with glade? It seems like a > shame to have to type xml and attach it manually when glade has such a > nice menu and toolbar editor. You should look at gazpacho, which has an editor for UIManager. Johan Dahlin ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] output > gtk.TextView
Am Sonntag, den 17.10.2004, 16:36 -0500 schrieb Skip Montanaro: > Marcus> I want to execute some shell commands in my python script. The > Marcus> output should be redirected to a gtk.TextView in real-time. How > Marcus> can I do this? > > Use os.popen or one of its cousins, capture the output via reads on the file > object returned, then stuff it into the TextBuffer associated with your > TextView widget. That I've making, now. But the text gets insert when the shell command is finished. Is there are not another possibility? regard Marcus ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] I must be missing something - can't get label of a menu item
On Mon, Oct 18, 2004 at 07:15:32PM +0100, Gustavo J. A. M. Carneiro wrote: > It's just that you have to get the selected menu item first, only then > get_data. It forces you to understand the internal structure of the > option menu to get to the selected menu item. Well, isn't it just a matter of doing: optionmenu.get_menu().get_active() -- ? I tend to find using that a lot more straightforward than using get_history() to get the index and then depend on a shared data structure (which may or may not be available where you need it). Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] I must be missing something - can't get label of a menu item
Seg, 2004-10-18 às 14:55 -0300, Christian Robottom Reis escreveu: > On Fri, Oct 15, 2004 at 11:04:39PM +0100, Gustavo J. A. M. Carneiro wrote: > > > Johan's suggested the FAQ, and that's full of warnings that should be > > > heeded. One alternative which I use daily is, instead of relying on the > > > label, doing a set_data() on the menuitems as you put them into the > > > menu, and then using get_data() to grab it back. I can get example code > > > if that's not clear enough. > > > > > > There's one catch -- you can't use None given get_data() returns None by > > > default; just use a ValueUnset dummy class to work around that, though. > > > > Actually, I think the only clean solution is to use > > gtk.OptionMenu.get_history(), as index to a list of strings, or whatever > > you want associated with each option. > > Hmmm. What's wrong with the get_data() approach I outlined? It frees you > from using strings and shared data structures, at least. It's just that you have to get the selected menu item first, only then get_data. It forces you to understand the internal structure of the option menu to get to the selected menu item. get_history is more straightforward, and you don't have to know anything about menus or menu items. Anyway, this discussion is irrelevant, since the widget is deprecated. :-) > > Take care, > -- > Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331 -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> The universe is always one step beyond logic. smime.p7s Description: S/MIME cryptographic signature ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Alignment & scale
Hello folks, I've noticed that the default values for xscale and yscale in gtk.Alignment have recently been changed from 0.0 to 1.0: >>> import gtk >>> align = gtk.Alignment() >>> align.get_property("xscale") 1.0 >>> align.get_property("yscale") 1.0 Documentation is still pointing out that both parameters default to 0.0. -- Gustavo Niemeyer http://niemeyer.net ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] FontSelection set_font_name() returns false on valid name
John Finlay writes: > It needs to be added to a window before the font lists are > populated. Ah, thank you! I had tried calling the method after it had been added to its container (which is not a window), but not after the container had been added to the window. Jamie -- Artefact Publishing: http://www.artefact.org.nz/ GnuPG Public Key: http://www.artefact.org.nz/people/jamie.html ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] glade and new gtk+ actions
Is anybody using the new UIManager/Actions with glade? It seems like a shame to have to type xml and attach it manually when glade has such a nice menu and toolbar editor. Stephen. -- Stephen Kennedy <[EMAIL PROTECTED]> http://meld.sf.net visual diff and merge ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] how to map modifier keys to bits in modifier masks?
In the docs for gtk.gdk.Event the description of MOD1_MASK reads: gtk.gdk.MOD1_MASK The fourth modifier key (it depends on the modifier mapping of the X server which key is interpreted as this modifier, but normally it is the Alt key). How do I determine the mapping at run-time (without human intervention)? I wrote a trivial PyGTK script that picks apart and prints the modifier mask for various events, but I can't have each user run that and build a little database for me. On my particular setup (Solaris Intel running Xi Graphics X server v. 11) NumLock is actually MOD2 while Left Alt is MOD4 and Right Alt appears to be unassigned. Other people here at work run various other combinations of OS and X server software, so there is likely to be some variation. Thanks, -- Skip Montanaro [EMAIL PROTECTED] http://www.mojam.com/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] I must be missing something - can't get label of a menu item
On Fri, Oct 15, 2004 at 09:51:49PM -0500, Skip Montanaro wrote: > Christian> One alternative which I use daily is, instead of relying on > Christian> the label, doing a set_data() on the menuitems as you put > Christian> them into the menu, and then using get_data() to grab it > Christian> back. > > I suppose I can figure it out, but is that an option from a Glade-generated > interface? I am not at work so don't have Glade available to try at the > moment. No, AFAIK this is only available from code (i.e., you call set_data() on the menu item instances). It really depends on what you want to do -- if you *really* want the labels, then it's not the right way to go, but rarely have I needed to get the labels (and I've played with OptionMenu a *lot*). Take care, -- Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] FontSelection set_font_name() returns false on valid name
When passing the font name returned by gtk.FontSelection's get_font_name to set_font_name, that method always returns False and the font is not set in the selection. The font name is valid, and the font specified is available on the system (having selected it, it is used in displaying text). This is using Debian unstable's packages (python-gtk2 2.4.0-2). The problem also occured with the earlier 2.2 package. It appears that someone else had this same problem in July of last year (http://www.daa.com.au/pipermail/pygtk/2003-July/005546.html) but met with no public response. Here's a minimal demonstration: Python 2.3.4 (#2, Sep 24 2004, 08:39:09) [GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import gtk >>> f = gtk.FontSelection() >>> f.get_font_name() 'Sans 10' >>> f.set_font_name('Sans 12') False >>> f.get_font_name() 'Sans 10' Jamie -- Artefact Publishing: http://www.artefact.org.nz/ GnuPG Public Key: http://www.artefact.org.nz/people/jamie.html ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/