Код: Выделить всё
# defines default charcatersitics of buttons
:
background_normal: ''
font_size: 32
#defines default characteristics of textInputs
:
font_size: 32
#Defines the screens within screen Manager
ScreenManager:
makeFlashcardsScreen:
: # deifines the contesnts of the screen for making flashcards
name: "makeFlashcards"# name is used to link it to the build function in the py file
BoxLayout: # main Layout to hold the Scroll bar feature
orientation: 'vertical'
size: (root.width, root.height)
ScrollView: # adds a scrollbar feature along the y axis only
do_scroll_x: False
do_scroll_y: True
FloatLayout: # main layout of visible content, easily allows to place the text inputs
minHeight: self.parent.height*2
size_hint: (None,None)
size: (self.parent.width, self.minHeight)
TextInput:
hint_text: "Enter Set Name"
size_hint: (.4, None)
height: 60
pos_hint: {"x":.05, "top":.99}
TextInput:
hint_text: "Foulder select"
size_hint: (.25, None)
height: 60
pos_hint: {"x":.5, "top":.99}
BoxLayout: # a container to hold all flashcards
id: container
orientation: 'vertical'
# size: (self.parent.width, self.parent.height)
size_hint: (.8,.93)
pos_hint: {"center_x":.5}
canvas.before:
Color:
rgb: (1,1,1)
Line:
width: 2
rectangle: (self.x, self.y, self.width, self.height)
BoxLayout:
orientation: 'horizontal'
size_hint: (self.parent.width, None)
height: 80
spacing: 20
#add image input
TextInput:
hint_text: "Enter Term"
size_hint: (.3, None)# THESE ARE THE PROBLEM
height: 30
TextInput:
hint_text: "Enter a Hint"
size_hint: (.3, None)# THESE ARE THE PROBLEM
height: 30
TextInput:
hint_text: "Enter Answer"
size_hint: (.3, None)# THESE ARE THE PROBLEM
height: 30
#add image input
Это kv-файл, который используется, входные данные выходят за пределы макета родительского поля.
p>
Идея состоит в том, чтобы создать что-то похожее на это: введите здесь описание изображения. Но это простая версия для начинающих, в которой просто есть 3 текстовых поля рядом друг с другом и другие элементы, добавленные позже, например, кнопка удаления и добавить кнопки изображений
Ранее я пытался изменить макет поля на плавающее и относительное, но это еще более «глючно» или, по крайней мере, с ними труднее работать, и входные данные по-прежнему размещались не там, где рядом внутри своего родителя. Чтобы уточнить, мне нужна динамическая ширина, чтобы размер интерфейса изменялся, но выглядел хорошо и т. д.
Подробнее здесь: https://stackoverflow.com/questions/790 ... any-layout