By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

PyGUI show_text()

P: n/a
Heya,

any PyGUI users out there?

I needed some finer text-positioning on a canvas (ie wanted to center
a string wrt a point, something show_text() doesn't provide) So I
looked into the sources and found all information, eg the dimensions
of the surrounding rectangle
are given by
mycanvas._font._get_pango_layout(mystring, True).get_pixel_size()
>From this one can calculate a new basepoint, this works fine. I wonder
if there is a more elegant way I've overseen so far. (Or if not,
Greg ;) would it be possible to include some optional positioning
parameters, something like left,center,right,top,middle,bottom to
show_text()).

All in all thanks a lot for PyGUI, even if it's still far away from
beeing complete.
To me it really brought back some fun in python-gui-programming.

Arnd

Feb 3 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Arnd wrote:
I needed some finer text-positioning on a canvas (ie wanted to center
a string wrt a point, something show_text() doesn't provide)
Fonts have ascent, descent, height and line_height
attributes, and a width() method for measuring the
width of a string. You should be able to find out
what you need to know from those.
would it be possible to include some optional positioning
parameters, something like left,center,right,top,middle,bottom to
show_text()).
Yes, I'm considering something like that.
All in all thanks a lot for PyGUI,
Glad you like it!

--
Greg
Feb 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.