kivy.uix.textinput.TextInput not working with GridLayout

179 views
Skip to first unread message

katesfb

unread,
May 2, 2021, 4:29:38 AM5/2/21
to Kivy users support

Hi,
I am a Kivy newby and this is my first post.

I am trying to create a grid layout with buttons, labels and text input. Buttons and labels seem to work but there is a problem with text input. The test script  is as follows:

from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout

class GridLayoutEx(App):
    def build(self):
         layout = GridLayout(cols=1)
         textinput = TextInput(text='Hello world', multiline=False)
         layout.add_widget(textinput)
         textinput2 = TextInput(text='Hello world2', multiline=False)
         layout.add_widget(textinput2)

        return layout
    
if __name__ == "__main__":
    GridLayoutEx().run()

When this is script is run it starts to create a window but then stops so that the end result is a window with nothing in it. It doesn't even get to the point where it creates the window background.

Console output from the run is as follows:
Python 3.8.5 (/usr/bin/python3)
>>> %Run GridLayoutTxtInput.py
[INFO   ] [Logger      ] Record log in /home/richard/.kivy/logs/kivy_21-05-02_0.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] Backend used <gl>
[INFO   ] [GL          ] OpenGL version <b'3.0 Mesa 20.0.8'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel Open Source Technology Center'>
[INFO   ] [GL          ] OpenGL renderer <b'Mesa DRI Intel(R) HD Graphics 4400 (HSW GT2)'>
[INFO   ] [GL          ] OpenGL parsed version: 3, 0
[INFO   ] [GL          ] Shading version <b'1.30'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [GL          ] NPOT texture support is available

Kivy ver = 1.10
Python ver = 3.8.5
OS = Linux

Any help with this would be much appreciated.

Cheers.

Elliot Garbus

unread,
May 2, 2021, 11:38:26 AM5/2/21
to kivy-...@googlegroups.com

It appears you are using an older version of kivy with a newer version of Python that it does not support.

The current stable version of kivy is 2.0.0

Installation directions:  https://kivy.org/doc/stable/gettingstarted/installation.html

 

I ran your code on my installation and it works.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/9069d22f-b049-4dcd-9239-f31f964b7e31n%40googlegroups.com.

 

katesfb

unread,
May 3, 2021, 6:41:29 AM5/3/21
to Kivy users support
HI ElliotG,
And thanks for the reply. Much appreciated.

Your advice to install the current stable version of KIvy makes sense and i have done that but initially it did not make any difference however i decided to change the Python IDE i was using (Thonny) to an old favourite (Idle) which displayed correctly so the older version of Kivy may have worked but it makes sense to use the up to date version anyway. I now just need to find out why the Text Input examples specifically do not display at all in Thonny whereas all the other examples (buttons, labels, scrolling etc) do. Doesnt make any sense to me. Any thoughts on that?

Thanks for all your help.

Cheers.

Elliot Garbus

unread,
May 3, 2021, 11:34:44 AM5/3/21
to kivy-...@googlegroups.com

I would not expect kivy to work properly with IDLE.  I’m not familiar enough with Thorney to have an opinion.

Kivy, like any GUI, uses an event loop at it’s core.   It is always running seeing if an event has occurred (ie Button press…)

 

Kivy will work with PyCharm if you want a full ide.  Try running your program from the command line to see if it is an interaction with Thorney causing the problem or some other system issue.

katesfb

unread,
May 4, 2021, 6:15:29 PM5/4/21
to Kivy users support
Hi,
And thanks for  the reply.

I tried running from the command line which worked correctly. I also tried another IDE (Geany) and that also worked fine. So it seems that the issue may solely be with Thonny which is odd and unfortunate as i quite like it.

Thanks for all your help.

Cheers.

Reply all
Reply to author
Forward
0 new messages