Re: [pygtk] SpinButton and a value of None

2005-11-28 Thread N. Volbers

Graham Ashton schrieb:


On Thursday 24 November, N. Volbers wrote:

 

My second problem arises due to the fact that it should be possible  to 
specify no value at all.


[snip]

Am I missing something obvious? I would appreciate any suggestions
on this.
   



If you want a single widget that allows you to specify "a positive
integer or nothing" I think you'll need to look elsewhere.

You may be building a better UI if you add a checkbox to cover the
case where you don't want to specify an integer; i.e. ticking the box
de-sensitises the spin button and signifies "None".

 


OK, this is what I wanted to know. I guess I will implement it that way.

Thanks,

Niklas Volbers.

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


Re: [pygtk] [Fwd: Label text does not span width of container]

2005-11-28 Thread John Finlay
I think you should ask this question on the one of the GTK+ mail lists - 
say gtk-app-devel-list


John

Nicodaemus wrote:


(the original query)

I have a simple program with a label on the main program window.

I place some text in the label and set the 'set_line_wrap' property of
the label to True.

However, when I run the script I notice that the text in the label does
not span the entire width of the window, as there are left and right
borders of space surrounding the label's text.

How do I alter the properties of the label so that the rendered text in
the label spans the entire width of the parent window/container?

I have tried using a v/hbox without success, and experimenting with
glade and various container configurations yields the same outcome.

I do not want to alter the width of the window to match the width of the
rendered text, but would prefer to have the width of the rendered text
'expanded' to meet the left and right edges of the window.

Any assistance will be appreciated.


#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk

class dislabel:
   def __init__(self):
   self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
   self.window.connect("destroy", lambda w: gtk.main_quit())

   self.window.set_title("Label with   set_line_wrap ( True )")
self.window.set_size_request(600, 200)

dastring = "I am feeling somewhat claustrophobic as "\
+"there are vertical borders of empty space to the "\
+"right and left of this label, even though this "\
+"label has been assigned the value set_line_wrap (True)."\
+" How do I remove these annoying spaces and have "\
+"the text of the label span the entire width "\
+"of the window/container?"

label = gtk.Label(dastring)

label.set_line_wrap(True)

self.window.add(label)

   self.window.show_all ()

def main():
   gtk.main()
   return 0

if __name__ == "__main__":
   dislabel()
   main()



]

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



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


[pygtk] [Fwd: Label text does not span width of container]

2005-11-28 Thread Nicodaemus
(the original query)

I have a simple program with a label on the main program window.

I place some text in the label and set the 'set_line_wrap' property of
the label to True.

However, when I run the script I notice that the text in the label does
not span the entire width of the window, as there are left and right
borders of space surrounding the label's text.

How do I alter the properties of the label so that the rendered text in
the label spans the entire width of the parent window/container?

I have tried using a v/hbox without success, and experimenting with
glade and various container configurations yields the same outcome.

I do not want to alter the width of the window to match the width of the
rendered text, but would prefer to have the width of the rendered text
'expanded' to meet the left and right edges of the window.

Any assistance will be appreciated.


#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk

class dislabel:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("destroy", lambda w: gtk.main_quit())

self.window.set_title("Label with   set_line_wrap ( True )")
self.window.set_size_request(600, 200)

dastring = "I am feeling somewhat claustrophobic as "\
+"there are vertical borders of empty space to the "\
+"right and left of this label, even though this "\
+"label has been assigned the value set_line_wrap (True)."\
+" How do I remove these annoying spaces and have "\
+"the text of the label span the entire width "\
+"of the window/container?"

label = gtk.Label(dastring)

label.set_line_wrap(True)

self.window.add(label)
 
self.window.show_all ()

def main():
gtk.main()
return 0

if __name__ == "__main__":
dislabel()
main()



]

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


Re: [pygtk] Help with modal in Gtk::FileChooserDialog

2005-11-28 Thread dannym
Hi,

Am Montag, den 28.11.2005, 15:47 -0500 schrieb Graham Ashton:
> On Monday 28 November, dannym wrote:
> 
> > Usually you just use a modal event loop:
> > 
> > dialog = gtk.FileChooserDialog()
> > answer = dialog.run() # hangs around until dialog is closed
> > del dialog
> 
> Hi. Wouldn't it be better to say:
> 
>   dialog.destroy()
> 
> instead of
> 
>   del dialog
> 
> ?
> 
> It was a long time ago that I did looked into this, but I found that
> in order to avoid memory leaks in long running processes that
> created/destroyed a lot of widgets, I had to explicitly call destroy()
> myself. I confess I'm not even sure if del calls it for you...

I have no idea. My gut feeling says that exactly the same should happen
when you del it manually than what would happen if it were just gc'ed
after you closed it.

However, your scenario is entirely possible too (i.e. gtk_object_destroy
is never called. Note that gtk_object_destroy is merely a method that
emits a signal "destroy" to which others can connect and make sure that
they don't hold a reference to the widget anymore, which would have
caused it to idle around indefinitely, as an immortal)

Would be worth testing .. care to test? :)

cheers,
   Danny


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


Re: [pygtk] SpinButton and a value of None

2005-11-28 Thread Graham Ashton
On Thursday 24 November, N. Volbers wrote:

> My second problem arises due to the fact that it should be possible  to 
> specify no value at all.
>
> [snip]
> 
> Am I missing something obvious? I would appreciate any suggestions
> on this.

If you want a single widget that allows you to specify "a positive
integer or nothing" I think you'll need to look elsewhere.

You may be building a better UI if you add a checkbox to cover the
case where you don't want to specify an integer; i.e. ticking the box
de-sensitises the spin button and signifies "None".

-- 
Graham Ashton
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Help with modal in Gtk::FileChooserDialog

2005-11-28 Thread Graham Ashton
On Monday 28 November, dannym wrote:

> Usually you just use a modal event loop:
> 
> dialog = gtk.FileChooserDialog()
> answer = dialog.run() # hangs around until dialog is closed
> del dialog

Hi. Wouldn't it be better to say:

  dialog.destroy()

instead of

  del dialog

?

It was a long time ago that I did looked into this, but I found that
in order to avoid memory leaks in long running processes that
created/destroyed a lot of widgets, I had to explicitly call destroy()
myself. I confess I'm not even sure if del calls it for you...

-- 
Graham Ashton
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Help with modal in Gtk::FileChooserDialog

2005-11-28 Thread dannym
Hi,

Am Dienstag, den 22.11.2005, 14:37 -0500 schrieb Thierry Lam:
>  
> 
> Does anyone know how to set modal to True for Gtk::FileChooserDialog?

Usually you just use a modal event loop:

dialog = gtk.FileChooserDialog()
answer = dialog.run() # hangs around until dialog is closed
del dialog
> 
>  
> 
> Thanks
> 
> Thierry

cheers,
   Danny
> 

> 

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


Re: [pygtk] Disabling or greying out other windows

2005-11-28 Thread dannym
Hi,

Am Montag, den 21.11.2005, 16:08 -0500 schrieb Thierry Lam:
> Let's say I have a main window which has a File menu. When I click on
> the File menu and the open button, I have a File Chooser window which
> comes in front of my main window.  How do I make the main window
> unselectable?  That is, the only window I should be able to select at
> this point is the File Chooser window while the main one is greyed
> out.

Set the dialog modal. Easiest to do it just to call "run()" on the
dialog.

Note that this is a little different from what you described. You can
still minimize/move/... the main window, but the events will be ignored
as long as the file dialog is open. Which is nice :)

> 
> Thanks
> Thierry
> 
cheers,
   Danny



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


Re: [pygtk] Does such a widget exist?

2005-11-28 Thread dannym
Hi,

Am Mittwoch, den 16.11.2005, 19:51 +0100 schrieb Stefano Esposito:
> Hi all,
> 
> i need a widget that displays mobile/fixed points and fixed rectangles and 
> which is capable to catch mouse-click events. Does such a widget exist 
> somewhere in the world? :)

diacanvas perhaps, if I understand you right...

> 
> Bye
> Stefano

cheers,
   Danny


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


Re: [pygtk] Re: Pixbuf memory leak?

2005-11-28 Thread dannym
Hi,

Am Mittwoch, den 16.11.2005, 09:06 + schrieb Loris Caren:
> On Tuesday 15 November 2005 21:06, you wrote:
> > I'm doing a large number of calls to
> > p = gtk.gdk.pixbuf_new_from_file(f)
> > ...
> > del p
> > and am finding that the process consumes more and more memory as it
> > goes on.  Should I expect the del to free up the memory used by the
> > loaded image, or is there some kind of 'close' call I need to be
> > invoking first?
> Think I've found the answer to this one in the archives. Various other 
> people have reported a similar bug, but 
> http://article.gmane.org/gmane.comp.gnome.gtk+.python/2315/match=pixbuf
> suggests it's an issue with the garbage collector. Adding an explicit 
> gc.collect() after my del stops my memory usage wandering off the 
> scale.  This looks like a generic issue for anyone manipulating lots 
> of large objects, and an easy trap for those that thought that python 
> 'just did' memory allocation and one never need bother about it.

I'm also disturbed by this and I wonder if it is possible to have python
memorize the "virtual size" aswell, and then garbage collect using the
"virtual size" instead of the (real) size of the handle.

I think this should be brought to the attention of the developers of
python, since they should know best how to proceed.

Note that the "handle size < data size" problem would be a quite
universal problem (thinking about any python C extensions here)

cheers,
   Danny


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


Re: [pygtk] Error with rc_parse

2005-11-28 Thread spike grobstein
short answer:

widget "*.head" style head

long answer:

your widget definition in the gtkrc is saying "a GtkLabel contained in a widget 
called 'head'"

since you're naming your label "head", you need to define the line as:

widget "*.head" style "head"

that will instruct gtk to style a widget named "head" that's packed inside any 
widget.

hope this helps. =)

gtkrcs are a pain and I've been having trouble finding decent documentation on 
them. I just started with them a couple of nights ago since you have more 
control over the appearance of widgets than with direct code (there are some 
attributes that can't be modified through code, so far as I can tell).


...spike

 
On Monday, November 28, 2005, at 11:29AM, tjas ni <[EMAIL PROTECTED]> wrote:

>
><>___
>pygtk mailing list   pygtk@daa.com.au
>http://www.daa.com.au/mailman/listinfo/pygtk
>Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
>




...spike
On 11/28/05, tjas ni <[EMAIL PROTECTED]> wrote:
Thanks, gtk.rc_parse("test") worked fine!
But I got into some other problems.
I defined a GtkLabel with this command: headline.set_name("head")

In my RC file I inserted this line:
widget "head.GtkLabel" style "head"

but my 'head' label aint getting bold text as I want.
The RC file works, it's taken from the gtk doc examples...


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


[pygtk] [Fwd: Label text does not span width of container]

2005-11-28 Thread Nicodaemus
Hello,

I tried to send the following query to your pygtk post, but I don't
think I succeeded.

Please let me know the correct way to post a new query or reply to an
existing query.

Thank you.

John Anderson
--- Begin Message ---
I have a simple program with a label on the main program window.

I place some text in the label and set the 'set_line_wrap' property of
the label to True.

However, when I run the script I notice that the text in the label does
not span the entire width of the window, as there are left and right
borders of space surrounding the label's text.

How do I alter the properties of the label so that the rendered text in
the label spans the entire width of the parent window/container?

I have tried using a v/hbox without success, and experimenting with
glade and various container configurations yields the same outcome.

I do not want to alter the width of the window to match the width of the
rendered text, but would prefer to have the width of the rendered text
'expanded' to meet the left and right edges of the window.

Any assistance will be appreciated.


#!/usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk

class dislabel:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("destroy", lambda w: gtk.main_quit())

self.window.set_title("Label with   set_line_wrap ( True )")
self.window.set_size_request(600, 200)

dastring = "I am feeling somewhat claustrophobic as "\
+"there are vertical borders of empty space to the "\
+"right and left of this label, even though this "\
+"label has been assigned the value set_line_wrap (True)."\
+" How do I remove these annoying spaces and have "\
+"the text of the label span the entire width "\
+"of the window/container?"

label = gtk.Label(dastring)

label.set_line_wrap(True)

self.window.add(label)
 
self.window.show_all ()

def main():
gtk.main()
return 0

if __name__ == "__main__":
dislabel()
main()



--- End Message ---
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Error with rc_parse

2005-11-28 Thread tjas ni
On 11/28/05, tjas ni <[EMAIL PROTECTED]> wrote:
Thanks, gtk.rc_parse("test") worked fine!
But I got into some other problems.
I defined a GtkLabel with this command: headline.set_name("head")

In my RC file I inserted this line:
widget "head.GtkLabel" style "head"

but my 'head' label aint getting bold text as I want.
The RC file works, it's taken from the gtk doc examples...


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


Re: [pygtk] Error with rc_parse

2005-11-28 Thread tjas ni
On 11/27/05, spike grobstein <[EMAIL PROTECTED]> wrote:
how are you importing pygtk?try like this:import pygtkpygtk.require('2.0')import gtkgtk.rc_parse("test") # rc file's path should be relative to thesource file that calls this

Thanks, gtk.rc_parse("test") worked fine!

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