Re: [PyGtk] Name of the font I use

2002-04-30 Thread James Henstridge

Janos Blazi wrote:

>Is there a way to find out the name of the font I use (e.g. Nimbus Sans I)?
>I tried to call font_id but to no avail (and I am not even sure that tha
>would have been the right call).
>  
>
If you are using the 1.99.x snapshots, simply use the get_family() 
method of the font description object.  As gtk 1.2's font model had some 
issues, there isn't an API for doing the reverse font -> name mapping.

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/




___
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] Memory usage question

2002-04-30 Thread James Henstridge

Graham Ashton wrote:

>Hi.
>
>I've been experimenting with libglade from Python, and have found that I
>can use up an awful amount of memory incredibly quickly by destroying
>and re-creating widgets. I've written a small script that demonstrates
>it.
>
>There is a small window with a label and a button on it. When you click
>the button the label gets replaced repeatedly with a new copy. It's the
>while loop in the recreate_label() function that does the replacement,
>and causes the memory gobbling.
>
>#!/usr/bin/env python
>#
># $Id$
>
>
>import gtk, libglade, time
>
>
>def recreate_label(signal, label, vbox):
>label.destroy()
>while 1:
>   wtree = libglade.GladeXML("project1.glade", "label")
>   label = wtree.get_widget("label")
>   vbox.pack_start(label)
>   vbox.reorder_child(label, 0)
>   label.destroy()
>
>
>if __name__ == "__main__":
>wtree = libglade.GladeXML("project1.glade", "window1")
>window = wtree.get_widget("window1")
>button = wtree.get_widget("button")
>button.signal_connect("clicked", recreate_label,
> wtree.get_widget("label"),
> wtree.get_widget("vbox1"))
>window.show()
>gtk.mainloop()
>
>If anybody would like the Glade file that goes with it to play around,
>drop me a line and I'll post it. It's only short.
>
>So my question is - am I doing something wrong (most likely), or is this
>a leak? I'm using the latest stable pygnome (i.e. on GNOME 1.4), with
>Python 2.2, all compiled from source.
>  
>
If you could run this under memprof to see which allocations are using 
the most memory?  What if you change the labe.destroy() calls to this?:
  vbox.remove(label)

If you feel like it, you could also try the latest pygtk 1.99.x release 
to see if it has the same problem (much of the code has been rewritten 
for the 2.0 release of both pygtk and libglade).

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/




___
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] Copying text to X clipboard

2002-04-30 Thread Jon Nelson

On Tue, 30 Apr 2002 17:45:13 -0300 (BRT)
"Ricardo Froehlich" <[EMAIL PROTECTED]> wrote:

>   I've come to the necessity of copying a text(string) to
>   the X clipboard,
> but I couldn't find a way to do it. Can anybody help? James?

Read the section at the **excellent** pygtk translation of
the GTK tutorial at:

http://www.moeraki.com/pygtktutorial/ch-managingselections.html

-- 
Jon Nelson
C and Python Programmer, Code Gardener
Just because it's not broken doesn't mean we can't take it apart.
___
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] Copying text to X clipboard

2002-04-30 Thread Ricardo Froehlich


Hi there,

I've come to the necessity of copying a text(string) to the X clipboard,
but I couldn't find a way to do it. Can anybody help? James?

Thanks,

Ricardo


---
Ricardo Froehlich   Async Open Source
([EMAIL PROTECTED])  http://www.async.com.br/
(16) 9132 5538  +55 (16) 272 3330

/"\
\ /  Campanha da fita ASCII - Contra mail HTML
 X   ASCII ribbon campaign  - Against HTML mail
/ \


___
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] Name of the font I use

2002-04-30 Thread Mathew Yeates


I don't think so. The gdk structure GdkFont does not save the font name.
All you can really do is find out the height and width of a string with
your font.

Mathew
> Is there a way to find out the name of the font I use (e.g. Nimbus Sans I)?
> I tried to call font_id but to no avail (and I am not even sure that tha
> would have been the right call).
> 
> TIA,
> J.B.
> 
> -- 
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.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/


___
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] Name of the font I use

2002-04-30 Thread Janos Blazi

Is there a way to find out the name of the font I use (e.g. Nimbus Sans I)?
I tried to call font_id but to no avail (and I am not even sure that tha
would have been the right call).

TIA,
J.B.

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.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/



[pygtk] Memory usage question

2002-04-30 Thread Graham Ashton

Hi.

I've been experimenting with libglade from Python, and have found that I
can use up an awful amount of memory incredibly quickly by destroying
and re-creating widgets. I've written a small script that demonstrates
it.

There is a small window with a label and a button on it. When you click
the button the label gets replaced repeatedly with a new copy. It's the
while loop in the recreate_label() function that does the replacement,
and causes the memory gobbling.

#!/usr/bin/env python
#
# $Id$


import gtk, libglade, time


def recreate_label(signal, label, vbox):
label.destroy()
while 1:
wtree = libglade.GladeXML("project1.glade", "label")
label = wtree.get_widget("label")
vbox.pack_start(label)
vbox.reorder_child(label, 0)
label.destroy()


if __name__ == "__main__":
wtree = libglade.GladeXML("project1.glade", "window1")
window = wtree.get_widget("window1")
button = wtree.get_widget("button")
button.signal_connect("clicked", recreate_label,
  wtree.get_widget("label"),
  wtree.get_widget("vbox1"))
window.show()
gtk.mainloop()

If anybody would like the Glade file that goes with it to play around,
drop me a line and I'll post it. It's only short.

So my question is - am I doing something wrong (most likely), or is this
a leak? I'm using the latest stable pygnome (i.e. on GNOME 1.4), with
Python 2.2, all compiled from source.

Thanks.

-- 
Graham Ashton

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/