FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: Word wrap with Pychan  (Read 2378 times)

Bretzel13

  • Newbie
  • Posts: 19
    • View Profile
Word wrap with Pychan
« on: July 07, 2009, 07:48:01 pm »

Hey it's Bretzel from PARPG,

I just realized that Pychan does not support word wrap.

For example if I did this:
Code: [Select]
<Label name="whatever" text="a really long string" />

"a really long string" would just run off the window and not wrap at all.

Is there a workaround I could use?

Thanks,
Bretzel
Logged

Bretzel13

  • Newbie
  • Posts: 19
    • View Profile
Re: Word wrap with Pychan
« Reply #1 on: July 07, 2009, 09:17:10 pm »

Well, I figured it out!

You can just use the standard python module textwrap. It works great :D
Logged

chewie

  • Developer
  • Full Member
  • *
  • Posts: 123
    • View Profile
    • zero-projekt.net
Re: Word wrap with Pychan
« Reply #2 on: July 09, 2009, 12:51:45 pm »

The Label widget has a word_wrapping function which is set to False on default.

Code: [Select]
myLabel = pychan.widgets.Label(wrap_text=True)
myLabel.max_width = myMaxWidth

should do the trick.

See pychan doc for more details:

Pychan Label doc

Bretzel13

  • Newbie
  • Posts: 19
    • View Profile
Re: Word wrap with Pychan
« Reply #3 on: July 11, 2009, 04:59:43 pm »

Ah, that works too.

Thanks chewie!
Logged