gui.Dlg input window size

171 views
Skip to first unread message

tomasz....@gmail.com

unread,
Dec 15, 2013, 10:56:16 AM12/15/13
to psychop...@googlegroups.com
Hi Psychopy Users,
I looking for some help with gui.Dlg. I would like to input e.g. text 20 characters long and have whole text displayed on the screen. When I use guy.Dlg I can see only 6 characters of the text. 
can I ask you for belt how to set the input window size.

regards,
tomasz

Jeremy Gray

unread,
Dec 15, 2013, 11:09:43 AM12/15/13
to psychop...@googlegroups.com
Hi Tomasz,

I think you are referring to the gui.Dlg.addField input box. There's
not a way to control its length directly. But you can control it
indirectly by giving an initial value that is the desired length (20),
with all spaces. You may need more than 20 spaces to allow display of
20 characters when using a proportional font.

d = gui.Dlg()
d.addField(label='larger input', initial=' ' * 20)
d.show()

Then you can do .strip() on the returned value to remove the trailing spaces.
--Jeremy
> --
> You received this message because you are subscribed to the Google Groups
> "psychopy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to psychopy-user...@googlegroups.com.
> To post to this group, send email to psychop...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/psychopy-users/e2f33180-da71-4909-8f3a-611888e85228%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Jeremy Gray

unread,
Dec 15, 2013, 2:36:41 PM12/15/13
to psychop...@googlegroups.com
Here's a way to adjust the code so that spaces are not needed--add a
fieldLength argument / parameter:
https://github.com/jeremygray/psychopy/commit/c40f0477d8a285817039334ed0d8c0fc47466797

--Jeremy
--Jeremy

tomasz....@gmail.com

unread,
Dec 15, 2013, 2:38:20 PM12/15/13
to psychop...@googlegroups.com
Hi Jeremy,
thank you.
with regards,
t.
Reply all
Reply to author
Forward
0 new messages