You Are Here:

Community: Developer Discussion Boards

#1 Old how to change the size of 'text' on canvas? - 2008-06-30, 17:22

Join Date: May 2008
Posts: 17
anyko38155285
Offline
Registered User
not 'normal' and 'legend'.
thanks!
Reply With Quote

#2 Old Re: how to change the size of 'text' on canvas? - 2008-06-30, 18:31

Join Date: Feb 2008
Posts: 25
Location: Moscow Russia
Send a message via ICQ to Versoul Send a message via Skype™ to Versoul
Versoul
Offline
Registered User
you con change fonts they change size too
Code:
.text((125,200),u'text',0x998800,font=u'Alb17b')
if you wont to know all fonts for you phone
Code:
import appuifw
print appuifw.available_fonts()
Reply With Quote

#3 Old Re: how to change the size of 'text' on canvas? - 2008-06-30, 18:59

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
If you have a somewhat newer phone (2nd ed. FP2 or newer AFAIK), you can also do something like this:
Code:
.text((125,200),u'text',0x998800,font=('normal', 30))
where 30 is the font size. Or even add a flags field:
Code:
.text((125,200),u'text',0x998800,font=('normal', 30, graphics.FONT_ANTIALIAS))
to enable antialiasing (there are other interesting flags, check PyS60 docs).
Reply With Quote

#4 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 05:02

Join Date: Feb 2008
Posts: 2,546
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Code:
.text((125,200),u'text',0x998800,font=('normal', 30))
[/quote]

hi y.a.k
why i am getting an error when using the above code as
invalid font specification.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#5 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 06:45

Join Date: May 2007
Posts: 2,739
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Are you using it on the canvas?

Please post the full line of code where these Fonts wish to be applied.

Best Regards,
Croozeus
Reply With Quote

#6 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 12:31

Join Date: Feb 2008
Posts: 2,546
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hey croozeus
the code i have posted below is almost complete. then also let me post it again
Code:
canvas.text((125,200),u'text',0x998800,font=('normal', 30))
hope except asking for code you have the solution also.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#7 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 12:44

Join Date: May 2007
Posts: 2,739
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Use

Code:
canvas.text((125,200),u'text',0x998800,font=('normal', 30))
Works with my device

BR,
Croozeus
Last edited by croozeus : 2008-07-01 at 12:49.
Reply With Quote

#8 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 12:48

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
@gaba88

Hmmm. Could you try this code? Because it works for me.
Code:
import appuifw, e32

canvas=appuifw.app.body=appuifw.Canvas()
canvas.text((125,200),u'text',0x998800,font=('normal',30))

a=e32.Ao_lock()
appuifw.app.exit_key_handler=a.signal
a.wait()
@croozeus

Somethings's wrong with your code, unmatched parenthesis.
Reply With Quote

#9 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 12:57

Join Date: Feb 2008
Posts: 2,546
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi y.a.k
again getting the same error as invalid font specification as i was getting previously.
I am testing it in n70.
@croozeus
why to use self.canvas instead of canvas???


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#10 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 12:58

Join Date: May 2007
Posts: 2,739
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by y.a.k View Post
@croozeus

Somethings's wrong with your code, unmatched parenthesis.
Yes, I had fixed it!
Reply With Quote

#11 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 13:09

Join Date: Feb 2008
Posts: 2,546
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi y.a.k
i think the problem is with the font which we have specified as i tried that without font specification and it worked.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#12 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 13:11

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
Still not working? Odd. Maybe you should post your whole code and the exact error traceback. Please do not retype the code on the PC, send it as it is and copy/paste here.
Reply With Quote

#13 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 13:15

Join Date: Feb 2008
Posts: 2,546
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
Quote:
Originally Posted by y.a.k View Post
Still not working? Odd. Maybe you should post your whole code and the exact error traceback. Please do not retype the code on the PC, send it as it is and copy/paste here.
hi y.a.k
the code is the same you posted i just want to change the text size on canvas.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#14 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 13:20

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
Post the exact error message. It is never just "Invalid font specification". There's always a hint after this sentence:
- wrong number of elements in tuple
- expected string, unicode or tuple
- expected unicode or None as font name

Which one do you get?
Reply With Quote

#15 Old Re: how to change the size of 'text' on canvas? - 2008-07-01, 13:33

Join Date: Feb 2008
Posts: 2,546
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi y.a.k
i get only just invalid font specification nothing like that you mentioned.
and the only problem is wid th font part i am investigating it.
moreover can anybody else try this code and verify the problem.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
large canvas text ianw Python 2 2008-06-12 17:22
Maximum size of text region? wftomas General Messaging 2 2005-04-01 09:10
Major problem with delegation to Canvas bartekn Mobile Java Media (Graphics & Sounds) 8 2003-10-08 18:46
how do you change the size of the font? Nokia_Archive General Symbian C++ 1 2002-05-31 15:42
Change the paintable canvas size of the emulator Nokia_Archived Mobile Java Tools & SDKs 1 2002-05-17 19:07

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia