Re: [pygtk] Dynamically creating columns in a ListStore

2002-11-06 Thread James Henstridge
Christian Reis wrote:


On Wed, Nov 06, 2002 at 12:49:48AM -0800, David M. Cook wrote:
 

On Tue, Nov 05, 2002 at 05:23:21PM +0800, James Henstridge wrote:

   

store = gtk.ListStore(*[str]*cols)
 

Whoa, slick, you can also use foo(**keys).  I can get rid of all those
awkward apply() invocations in my code.
   


Python 2.x only; 1.5 requires the apply.
 

Which is not an issue when the underlying modules require 2.2 ...

James.

--
Email: [EMAIL PROTECTED]  | Linux.conf.au   http://linux.conf.au/
WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Australia. 



___
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] getting the text from a ListItem

2002-11-06 Thread Christian Reis
On Wed, Nov 06, 2002 at 06:33:02PM -0500, Rajarshi Guha wrote:
> I have GtkList containing a number of GtkListItems. I've attached a function 
> that is connected to select_child signal - the function then recieves a 
> GtkList instance. Using get_selection() I get the GtkLIstItem - but I cant 
> see how to extract the text from the GtkListItem instance

Maybe call item.children() and see what is in there? IIRC, the item is
just a GtkBin, and it holds a widget of sorts. Look in there; most
probably you have a label.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] getting the text from a ListItem

2002-11-06 Thread Rajarshi Guha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I have GtkList containing a number of GtkListItems. I've attached a function 
that is connected to select_child signal - the function then recieves a 
GtkList instance. Using get_selection() I get the GtkLIstItem - but I cant 
see how to extract the text from the GtkListItem instance

Can somebody point out how to do it?

Thanks,


- -- 
- ---
Rajarshi Guha  <[EMAIL PROTECTED]> 
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
- ---
667:
The neighbor of the beast.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9yaazG7nmNJuHVu4RAjHDAJ9YHXvaspOvINV4nuapZ/2TGoLTPwCfUQBq
juXg+suH0SCTS4eZDsX/f8U=
=BsF/
-END PGP 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] Is anybody working on PyGtkScintilla2 ?

2002-11-06 Thread Ahmad Baitalmal




Scintilla 1.48 has been GTK2 enabled for a while now, and 1.49 now supports Unicode.

Only the port of the wrapper GtkScintilla to GTK2 is needed and we are in business.

Anybody already working on that ?





-  - --   - --- -- -   -

Ahmad Baitalmal

BitBuilder

web: http://www.bitbuilder.com

-  - --   -- --- -- -   -








Re: [pygtk] Example of changing fontsize with set_markup

2002-11-06 Thread Rob Brown-Bayliss
On Thu, 2002-11-07 at 07:12, Christian Reis wrote:
> On Wed, Nov 06, 2002 at 03:29:01PM +0100, René Olsthoorn wrote:
> > Dear list-readers,
> >  
> > I discovered that pango's markup language also allows exact font setting.
> > Setting the string to: 'Blue
> > text has size 38!' sets text to font 38.
> > By the way: the example only works on GTK2 and Python2, I think.
> 
> -> FAQ 7.3
> 

Some folks might find it does not work, I had tried this  few weeks ago
and it worked up to about the same size as the  tag in pango, after
that the fonts dropped to about 1-2 points.  After upgrading to a later
GTK snapshot this has been fixed.

-- 

*  Rob Brown-Bayliss
*  =
*  zoism.org
___
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: rotate text

2002-11-06 Thread François Pinard
[John Hunter]

> > "Andrew" == Andrew P Lentvorski <[EMAIL PROTECTED]> writes:

> Andrew> However, if you really want to handle text well, you
> Andrew> should probably look at something like PyFT (Python
> Andrew> Freetype) to render things with full flexibility and
> Andrew> accuracy.

> Thanks for the tip.  I just upgraded my freetype lib and installed PyFT.
> Do you have any demo code for PyFT, even better integrating PyFT with
> pygtk, to speed my along in getting up to speed with this vast new world?

One thing I liked a lot with Freetype (and PyFT) was the ability to
generate correctly anti-aliased letters on transparent background.
This helped for later GIMP montage, and printing at good resolution,
without too apparent loss of quality.  If I remember well, I chose to
defeat the outline caching in PyFT, because it was not very likely that
I use the same letter twice at the same size and in the same orientation.

This was for generating the labels (I'm not sure of the English word,
I really mean the papers to contain the art work) for a CD-ROM and its
plastic box.  I used PyFT with PIL (Python Imaging Library), but not in
`pygtk' context, so even if my two programs are not big, I'm hesitant
cluttering this mailing list with them.  Just ask me if you think they
could be useful as examples.  I'm not even sure they would work with the
most recent releases of Freetype and PyFT...

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard
___
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] RH8 pygtk0.6x, pygtk2-1.99x

2002-11-06 Thread Christian Reis
On Tue, Nov 05, 2002 at 09:16:38AM -0500, Don Radick wrote:
> but cannot find "gnome-python-1.4.4" anywhere, as stated in the
> pygtk FAQ section 2.1.

Added FAQ 1.13, ftp.gnome.org's layout changed, updated 2.1.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Re: co-exist pygtk 0.6xx and pygtk2 1.99xx?

2002-11-06 Thread Christian Reis
On Sun, Nov 03, 2002 at 10:18:26AM -0500, Don Radick wrote:
> from gtk import *
> pygtk.require("1.2")

a) you didnt import pygtk 
b) you tried to require pygtk *after* importing from gtk, which will
never work.

import pygtk
pygtk.require("1.2")
from gtk import *

Is what you want.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Pygtk for gtk 1.2 and 2.0 clarification

2002-11-06 Thread Christian Reis
On Mon, Nov 04, 2002 at 04:02:59PM -0600, Tanya Brethour wrote:
> picked the first one.  I installed it in a separate directory
> (/usr/local/lib/python2.2/site-packages). I added that path to my
> PYTHONPATH environment variable. 
> 
> So now... I have a couple of questions
> 
> 1) Shouldn't there be a gtk.py in /usr/local/lib/python2.2/site-packages? 
> I am only seeing pygtk.py. So calling import gtk only gets the old pygtk. 

No; you should set PYTHONPATH to

/usr/local/lib/python2.2/site-packages/gtk-2.0/

If you want "import gtk" to work straight away.  I *think* that if you
do:

PYTHONPATH=/usr/local/lib/python2.2/site-packages/

Then the following:

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

Might work.

> 2) Now when I put that path into my PYTHONPATH environ variable.. does it
> go to that directory first before the "default" (not sure if its termed
> default.. but the one that is in /usr/lib/python2.2)

Yes, it does. If you set pythonpath to "/usr/xxx" it will look first in
/usr/xxx, and then in the default system path. To debug these things,
use:

strace -eopen python xxx.py

And look at the open() system calls.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] libglade, python and gnome widgets: segmentation fault

2002-11-06 Thread Christian Reis
On Wed, Oct 30, 2002 at 05:32:35PM +, Padraig Brady wrote:
> So it's calling stock_button_new which has a shit attack since
> gnome.ui isn't imported.

Yeah, and I'm finding it's not too easy :-)

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] GtkImage, pixbuf woes under gtk2.x

2002-11-06 Thread Christian Reis
On Tue, Nov 05, 2002 at 05:20:31PM +0800, James Henstridge wrote:
> >What's the clean way to get two small (preferably inlined) images and
> >swap them back and forth into a togglebutton?
> >  
> >
> You can set a gtk.Image widget to display a pixmap (like the gtk.Pixmap 
> widget can) using its "set_from_pixmap" method, which acts like the 
> gtk.Pixmap.set() method.  That may make it a bit easier to convert your 
> code.

Updated FAQ 2.3

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Example of changing fontsize with set_markup

2002-11-06 Thread Christian Reis
On Wed, Nov 06, 2002 at 03:29:01PM +0100, René Olsthoorn wrote:
> Dear list-readers,
>  
> I discovered that pango's markup language also allows exact font setting.
> Setting the string to: 'Blue
> text has size 38!' sets text to font 38.
> By the way: the example only works on GTK2 and Python2, I think.

-> FAQ 7.3

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] rotate text

2002-11-06 Thread John Hunter
> "Andrew" == Andrew P Lentvorski <[EMAIL PROTECTED]> writes:

Andrew> However, if you really want to handle text well, you
Andrew> should probably look at something like PyFT (Python
Andrew> Freetype) to render things with full flexibility and
Andrew> accuracy.

Thanks for the tip.  I just upgraded my freetype lib and installed
PyFT.  Do you have any demo code for PyFT, even better integrating
PyFT with pygtk, to speed my along in getting up to speed with this
vast new world?

THanks,
John Hunter
___
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] Example of changing fontsize with set_markup

2002-11-06 Thread Christian Reis
On Wed, Nov 06, 2002 at 10:03:02AM +0100, René Olsthoorn wrote:
> Off-topic 2: Is there maybe a collection of code-snippets using PyGTK on the
> Net?

Many. Look at the FAQ, but there are tutorials and example applications
in many places:

http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq01.009.htp

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Entryfield validation extentions

2002-11-06 Thread Christian Reis
On Wed, Nov 06, 2002 at 03:25:37PM -0200, Christian Reis wrote:
> Want to take a stab?

"Want to try a stab at it" would be less threatening. :-)

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] error messages

2002-11-06 Thread Christian Reis
On Sun, Nov 03, 2002 at 10:34:50PM -0700, Jay Graves wrote:
> > If your system is set up to have the old pygtk as default, you will need 
> > to do the "import pygtk; pygtk.require('2.0')" bit first, and then 
> > import the "gnome" module.  You will also need to make sure you have a 
> > 1.99.x version of gnome-python installed.
> 
> Thats the problem.  The Debian unstable version of python-gnome is still
> at 1.4.4
> 
> I guess I will have to compile 1.99.x myself or wait till the newest
> packagte is available.

Jay, did you manage to get it working? 1.4.4 should support parallel
installing with 1.99.13 or later, which is why I ask.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Entryfield validation extentions

2002-11-06 Thread Christian Reis
On Mon, Nov 04, 2002 at 03:38:11PM +0100, René Olsthoorn wrote:
> 
> So, my question is: Did anyone create a similar GTK entryfield validator for
> Python?

I'm working on one. Would you like to help specify the API? I'm thinking
about using Validation objects that specify how you would like to
validate the entry; if you want masks, and so on. You could reuse the
validation object for as many entries as you like, and so on.

Want to take a stab?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Dynamically creating columns in a ListStore

2002-11-06 Thread Christian Reis
On Tue, Nov 05, 2002 at 05:23:21PM +0800, James Henstridge wrote:
> >What I'd like to do is something like:
> >
> >  store = gtk.ListStore([gobject.TYPE_STRING]*cols)
> >
> >  
> >
> Sure.  Python makes it quite easy to call a function that takes a 
> variable number of arguments with an argument vector.  You want to do 
> something like this:
>   store = gtk.ListStore(*[str]*cols)
> 
> Which is equivalent to:
>   store = gtk.ListStore(str, str, ..., str)   (cols times)

Became FAQ 13.18 (though it's really a Python FAQ)

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] dotted lines

2002-11-06 Thread Christian Reis
On Mon, Nov 04, 2002 at 11:38:51AM -0600, John Hunter wrote:
> > "John" == John Finlay <[EMAIL PROTECTED]> writes:
> 
> John> You can create your own dash pattern using
> John> set_dashes(). See:
> John> http://www.moeraki.com/pygtktutorial/sec-drawingarea.html#AEN1621
> 
> Thanks much, for the record, the code below creates the desired
> effect:
> 
> self._spacing = 2
[...]
> widget.draw_lines(gc, zip(x, y) )

Just became FAQ 18.4, with credits to both, thanks a lot.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Example of changing fontsize with set_markup

2002-11-06 Thread René Olsthoorn
Title: Example of changing fontsize with set_markup



Dear 
list-readers,
 
I 
discovered that pango's markup language also allows exact font 
setting.
Setting the string to: 'Blue text has size 38!' sets 
text to font 38.
By the 
way: the example only works on GTK2 and Python2, I think.
 
Greets, René Olsthoorn.
 

  -Original Message-From: René Olsthoorn 
  [mailto:[EMAIL PROTECTED]]Sent: woensdag 6 november 2002 
  10:03To: '[EMAIL PROTECTED]'Subject: [pygtk] Example of 
  changing fontsize with set_markup
  Dear PyGTK reader, 
  On the Net I found an example of using an other fontsize for a 
  label. The way it's done is nice: using  HTML-like tagging. (I 
  created a testprogram for PyGTK. The code is at the bottom of this 
  message).
  My question: using  does not allow exact 
  fontsizing. Does anyone have an PyGTK example of setting the exact 
  fontsize?
  Off-topic 1: It surprises me that I got no answers on my 
  "Entryfield validation extentions" question of 4-10-2002. In my opinion it is 
  one of the basic needs when creating software. How do you guys do 
  entryfield-validation?
  Off-topic 2: Is there maybe a collection of code-snippets 
  using PyGTK on the Net? 
  Greets and all good whishes, Rene 
  Olsthoorn. 
  # Example of changing the fontsize of a label. 
  # By Rene Olsthoorn. 
  import sys import gtk import gtk.glade import pango 
  def gtk_main_quit(*args):    
  gtk.main_quit() 
  def change_font(*args):    
  label.set_markup('Text with other fontsize') 
  
  window = gtk.Window() window.set_title("Fonttest") window.set_border_width(0) 
  vbox = gtk.VBox(gtk.FALSE, 0) window.add(vbox) 
  label = gtk.Label("Normal text") vbox.add(label) 
  button = gtk.Button("Change font of label") vbox.add(button) button.connect('clicked', 
  change_font) 
  button = gtk.Button("Quit") vbox.add(button) button.connect('clicked', 
  gtk_main_quit) 
  window.show_all() gtk.main() 
  


Re: [pygtk] Dynamically creating columns in a ListStore

2002-11-06 Thread Christian Reis
On Wed, Nov 06, 2002 at 12:49:48AM -0800, David M. Cook wrote:
> On Tue, Nov 05, 2002 at 05:23:21PM +0800, James Henstridge wrote:
> 
> >  store = gtk.ListStore(*[str]*cols)
> 
> Whoa, slick, you can also use foo(**keys).  I can get rid of all those
> awkward apply() invocations in my code.

Python 2.x only; 1.5 requires the apply.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
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] Entryfield validation extentions

2002-11-06 Thread Ricardo Froehlich

Hello René,

> So, my question is: Did anyone create a similar GTK entryfield validator for
> Python?

It's being implemented in Kiwi (http:/www.async.com.br/projects/Kiwi)
and is expected to be ready in version 0.60 (current version is 0.50)

Best regards,

-
Ricardo Froehlich

Async Open Source
http://www.async.com.br/
+55 (16) 261 2331

/"\
\ /  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/



[pygtk] Example of changing fontsize with set_markup

2002-11-06 Thread René Olsthoorn
Title: Example of changing fontsize with set_markup





Dear PyGTK reader,


On the Net I found an example of using an other fontsize for a label. The way it's done is nice: using  HTML-like tagging. (I created a testprogram for PyGTK. The code is at the bottom of this message).

My question: using  does not allow exact fontsizing. Does anyone have an PyGTK example of setting the exact fontsize?

Off-topic 1: It surprises me that I got no answers on my "Entryfield validation extentions" question of 4-10-2002. In my opinion it is one of the basic needs when creating software. How do you guys do entryfield-validation?

Off-topic 2: Is there maybe a collection of code-snippets using PyGTK on the Net?


Greets and all good whishes,
Rene Olsthoorn.



# Example of changing the fontsize of a label.
# By Rene Olsthoorn.


import sys
import gtk
import gtk.glade
import pango


def gtk_main_quit(*args):
   gtk.main_quit()


def change_font(*args):
   label.set_markup('Text with other fontsize')



window = gtk.Window()
window.set_title("Fonttest")
window.set_border_width(0)


vbox = gtk.VBox(gtk.FALSE, 0)
window.add(vbox) 


label = gtk.Label("Normal text")
vbox.add(label)


button = gtk.Button("Change font of label")
vbox.add(button)
button.connect('clicked', change_font)


button = gtk.Button("Quit")
vbox.add(button)
button.connect('clicked', gtk_main_quit)


window.show_all()
gtk.main()





Re: [pygtk] Dynamically creating columns in a ListStore

2002-11-06 Thread David M. Cook
On Tue, Nov 05, 2002 at 05:23:21PM +0800, James Henstridge wrote:

>  store = gtk.ListStore(*[str]*cols)

Whoa, slick, you can also use foo(**keys).  I can get rid of all those
awkward apply() invocations in my code.

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