Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
TextField Pythonista-anchors
-
@mikael
it seems that size_to_fit takes no effect on a TextField.. ?
is it an Bug ?
the height don't changesSample Code:
createCustomersCustomersProjectTextField = getTextField_area( ui.TextField(name="createCustomersCustomersProjectTextField"), "createCustomersCustomersProjectTextField", self.DEVICE, ) createCustomersCustomersProjectTextField.size_to_fit() createCustomersCustomersProjectTextField.width = self.WIDTH - 75 attach(createCustomersCustomersProjectTextField).below( createCustomersCustomersProjectLabel )
-
@DavinE, TextField is by definition a one-line text field. The height will probably change with font size, but not by the amount of text.
You might have been thinking of a TextView, see the sample below. (And remember to set the desired width before automatic sizing.)
import ui v = ui.View() tv = ui.TextView( text='Try this out\nfor size', font=('Arial Rounded MT Bold', 32), flex='RLTB', ) tv.width = 200 tv.size_to_fit() tv.center = v.bounds.center() v.add_subview(tv) v.present('fullscreen')
-
@mikael said:
@DavinE, TextField is by definition a one-line text field. The height will probably change with font size, but not by the amount of text.
My Font size is 16...
I use My Textfield in combination with an Action..
Then i will use the height Option for the TextField this will workI tried TextViews but this dont worked..
Thanks @mikael for your Great help
-
For TextView, you have to define a delegate in order to use actions.
-
Thanks @JonB