Re: [pygtk] Pango attribute

2004-02-13 Thread Malcolm Tredinnick
On Sat, 2004-02-14 at 15:52, Russell Shaw wrote:
[...]
> That didn't work for me:
> 
>window=gtk.Window(gtk.WINDOW_TOPLEVEL)
>vbox=gtk.VBox()
>window.add(vbox)
>label=gtk.Label("Name")
>label.set_use_markup(True);
>vbox.pack_start(label)
>window.show_all()

Cutting and pasting your exact worked for me (bold 'N', normal weight
for 'ame'). You did add something like gtk.main() in your main program,
right? Otherwise the GTK+ main loop will ever run and nothing will ever
be drawn.

Malcolm

___
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] Pango attribute

2004-02-13 Thread Russell Shaw
Gonzalo Sainz-Trápaga wrote:
Hi Russell,

On Fri, 2004-02-13 at 23:43, Russell Shaw wrote:

Hi,
How do i make the first letter of a gtk_label bold? I tried:
  label=gtk.Label("Name")
  attrlist=pango.AttrList()
  attr=pango.AttrWeight(pango.WEIGHT_BOLD)
  attrlist.insert(attr)
  label.set_attributes(attrlist)
Use pango's HTML-like markup:

label = gtk.Label("Name")
label.set_use_markup(True)
That didn't work for me:

  window=gtk.Window(gtk.WINDOW_TOPLEVEL)
  vbox=gtk.VBox()
  window.add(vbox)
  label=gtk.Label("Name")
  label.set_use_markup(True);
  vbox.pack_start(label)
  window.show_all()
___
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] Pango attribute

2004-02-13 Thread John Finlay
Russell Shaw wrote:

Bryan Clark wrote:

On Sat, 2004-02-14 at 01:41 +1100, Russell Shaw wrote:

I just learnt python and pango. I get this error:

python db.py

  Traceback (most recent call last):
File "db.py", line 68, in edit_mans
  attrlist=pango.AttrList()
  NameError: global name 'pango' is not defined
I've imported gtk. Is there something else i should import?
(i'm using debian)

> Hi Russell ~
>
> Try importing pango as well.
>
> import pango
>
> Hope that helps,
> ~ Bryan
Hi,
How do i make the first letter of a gtk_label bold? I tried:
  label=gtk.Label("Name")
  attrlist=pango.AttrList()
  attr=pango.AttrWeight(pango.WEIGHT_BOLD)
  attrlist.insert(attr)
  label.set_attributes(attrlist)
That should have worked.

John

___
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] Pango attribute

2004-02-13 Thread Russell Shaw
Gonzalo Sainz-Trápaga wrote:
Hi Russell,

On Fri, 2004-02-13 at 23:43, Russell Shaw wrote:

Hi,
How do i make the first letter of a gtk_label bold? I tried:
  label=gtk.Label("Name")
  attrlist=pango.AttrList()
  attr=pango.AttrWeight(pango.WEIGHT_BOLD)
  attrlist.insert(attr)
  label.set_attributes(attrlist)
Use pango's HTML-like markup:

label = gtk.Label("Name")
label.set_use_markup(True)
Ok, i'll use that. Anyway, how do you get the attrlist way to work?
I might need it for something else.
___
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] Pango attribute

2004-02-13 Thread Gonzalo Sainz-Trápaga
Hi Russell,

On Fri, 2004-02-13 at 23:43, Russell Shaw wrote:
> Hi,
> How do i make the first letter of a gtk_label bold? I tried:
> 
>label=gtk.Label("Name")
>attrlist=pango.AttrList()
>attr=pango.AttrWeight(pango.WEIGHT_BOLD)
>attrlist.insert(attr)
>label.set_attributes(attrlist)

Use pango's HTML-like markup:

label = gtk.Label("Name")
label.set_use_markup(True)

-- 
Gonzalo Sainz-Trápaga (GomoX)
GnuPG Fingerprint: A0AF 3BBF EB93 7EFE 6628  C5A5 F073 9442 6DE4 A497
Public Key:
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0x6DE4A497



signature.asc
Description: This is a digitally signed message part
___
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] Pango attribute

2004-02-13 Thread Russell Shaw
Bryan Clark wrote:
On Sat, 2004-02-14 at 01:41 +1100, Russell Shaw wrote:

I just learnt python and pango. I get this error:

python db.py

  Traceback (most recent call last):
File "db.py", line 68, in edit_mans
  attrlist=pango.AttrList()
  NameError: global name 'pango' is not defined
I've imported gtk. Is there something else i should import?
(i'm using debian)
> Hi Russell ~
>
> Try importing pango as well.
>
> import pango
>
> Hope that helps,
> ~ Bryan
Hi,
How do i make the first letter of a gtk_label bold? I tried:
  label=gtk.Label("Name")
  attrlist=pango.AttrList()
  attr=pango.AttrWeight(pango.WEIGHT_BOLD)
  attrlist.insert(attr)
  label.set_attributes(attrlist)
___
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] Combobox.entry changed handler problem

2004-02-13 Thread Steve McClure
I'm using GTK 1.2 and PyGTK 

My combo box glade attributes look like:
===
  True
  False
===

I have a handler for the 'changed' signal in a combobox.event widget. I
fill in the combobox.list widget list items dynamically. I have a helper
function that I pass all list items and the one I want selected and it
calls list.clear_items() then list.append_items(itemList).  When I do
this, the first item in the list is automatically selected and the
entryWidgetChangedCallback is called.  Then I do a
combo.list.select_item(desiredSelection) with the thing passed to my
helper, thus calling the entryWidgetChangedCallback again.  Since my
entryWidgetChangedCallback is slow, I want to avoid this.

I tried block and unblock of entryWidgetChangedCallback around the
clear_items() and append_items() and that indeed did the trick.  If the
desiredSelection is not the first item in the list everything works
fine. However, I thought a combo.entry.emit('changed') would be in order
if the first item in the list is the selected one since select_item()
doesn't really do anything in that case.  That causes
entryWidgetChangedCallback to be called twice.

===
combo.entry.signal_handler_block(self.dialogNameEntryChangedHandler)
combo.list.clear_items(0, -1)
combo.list.append_items(l)
combo.entry.signal_handler_unblock(self.dialogNameEntryChangedHandler)

if selectRow:
combo.list.select_item(selectRow)
else:
combo.entry.emit('changed')

===

I also tried:
===
set_value_in_list(gtk.FALSE, gtk.TRUE)
combo.list.clear_items(0, -1)
combo.list.append_items(l)
combo.list.select_item(selectRow)
combo.set_value_in_list(gtk.TRUE, gtk.FALSE)
===
but that didn't help either.

I'm sure my description is hard to follow, but if it happens to be
comprehensible, any help would be appreciated.
-- 
Steve McClure <[EMAIL PROTECTED]>
Racemi, Inc.


signature.asc
Description: This is a digitally signed message part
___
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] removing keybindings

2004-02-13 Thread Abel Daniel

How can I remove keybindings added with gtk.binding_entry_add_signal()?

I would like to make my app to have modes, a bit like the vi
editor. Launching a mode would change some keybindings. I figured I
can add the keybindings with gtk.binding_entry_add_signal() when the
mode is started, but the problem is, how do I remove them when the
user exits the mode?

-- 
Abel Daniel
___
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] gtkhtml2 wrappers: functions vs methods

2004-02-13 Thread Juri Pakaste
In the gtkhtml2 wrappers, there are a bunch of functions
(html_selection_*) that really ought to be methods of the view object.
Or if not, I'd love to know what I'm missing. 

I guess it's unacceptable to break backwards compatibility, but do
people think it would be worth it to make them methods and then add them
into the gtkhtml2 package as unbound methods in a __init__.py or
something like that?

On a related note, I just filed a bug to add a wrapper for
html_selection_get_text, #134345. I'd love to see it in the next
release. I'll also try to wrap some other parts of gtkhtml2.

-- 
[ Juri Pakaste / [EMAIL PROTECTED] / http://www.iki.fi/juri/ ]


signature.asc
Description: This is a digitally signed message part
___
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] Pango attribute

2004-02-13 Thread Bryan Clark
Hi Russell ~

Try importing pango as well.

import pango

Hope that helps,
~ Bryan

On Sat, 2004-02-14 at 01:41 +1100, Russell Shaw wrote:
> I just learnt python and pango. I get this error:
> 
> python db.py
> 
>Traceback (most recent call last):
>  File "db.py", line 68, in edit_mans
>attrlist=pango.AttrList()
>NameError: global name 'pango' is not defined
> 
> I've imported gtk. Is there something else i should import?
> (i'm using debian)



___
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] Pango attribute

2004-02-13 Thread Russell Shaw
Hi,
I just learnt python and pango. I get this error:
python db.py

  Traceback (most recent call last):
File "db.py", line 68, in edit_mans
  attrlist=pango.AttrList()
  NameError: global name 'pango' is not defined
I've imported gtk. Is there something else i should import?
(i'm using debian)
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/