[Sugar-devel] XML markup capability for a gtk.Button label (PyGTK)?

Tomeu Vizoso tomeu at sugarlabs.org
Thu Aug 6 03:59:19 EDT 2009


On Thu, Aug 6, 2009 at 03:43, Art Hunkins<abhunkin at uncg.edu> wrote:
> Hello, Victor and Mike (et al.),
>
> In reference to Victor's csndsugui.py (PyGTK):
>
> With gtk.Label and gtk.Frame, I've been able to use the set_use_markup()
> property to get larger fonts, bold, italics, etc - by including XML markup
> in my text strings.
>
> However, this property does not exist for gtk.Button, and I've got callback
> buttons that need these features too.
>
> Here is the relevent portion of a callback button that works fine (but no
> markup capability) - from csndsugui.py:
>
>   def cbbutton(self,box,callback,title=""):
>       butt = gtk.Button(" %s " % title)
>
> I tried unsuccessfully to add markup capability to this title by modifying
> the code thus:
>
>   def cbbutton(self,box,callback,title=""):
>       label = gtk.Label(title)
>       label.set_use_markup(True)
>       butt = gtk.Button(" %s " % label)
>
> Can this be made to work? (Sorry my PyGTK chops are so rudimentary.)

Can you try with this?

label = gtk.Label()
label.set_markup(title)
butt = gtk.Button()
butt.child = label
label.show()

Thanks,

Tomeu

> Art Hunkins
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


More information about the Sugar-devel mailing list