I'm trying to test the difference of having the kivy.Windows package inside a class vs outside a class (to try and solve the issue I am having here: Kivy TextInput to be above Android keyboard, however rest of screen to stay where it is ).
I am therefore trying to see if I have two separate FloatLayouts, within two classes, can I control just one of them. However what I noticed is that if I include both FloatLayouts within the same class, it displays everything fine, but if I try and have them in two separate classes, the top one vanishes, and no matter how I change the position, I can't see it on my screen. Why is this happening?
Here is my .py file:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window
#Window.softinput_mode = "below_target"
class Header(FloatLayout):
pass
class TestBox(FloatLayout):
pass
kv = Builder.load_file("rec_view.kv")
class RVTestApp(App):
def build(self):
return TestBox()
#return kv
if __name__ == "__main__":
RVTestApp().run()
Here is my .kv file:
<Header>:
FloatLayout:
Label:
pos_hint: {'center_x': 0.5, "top": 0.1}
size_hint: (0.2, 0.5)
font_size: 40
text: "TEXT AT TOP OF SCREEN"
<TestBox>:
FloatLayout:
TextInput:
pos_hint: {"x": 0.1, "y": 0.05}
size_hint: (0.3, 0.05)
multline:False
Button:
text: "CHECK BUTTON FOR ANSWERS AT BOTTOM OF SCREEN"
pos_hint: {"x": 0.6, "y": 0.05}
size_hint: (0.3, 0.05)
I thought it was initially because I was returning TestBox(), but even if I return Header() or kv, it shows a blank.
Any help would be much appreciated!