[英]Resizing Kivy Scroll View Label
我試圖在我的Kivy應用程序中向矩形添加滾動標簽。 我的滾動標簽工作正常,但是我無法調整滾動標簽的大小,因此它適合我的矩形。 我試圖弄亂高度或size_hint,但后來它不再滾動了。 下面是問題和代碼的圖片。
WindowManager:
MainWindow:
SettingsWindow:
HelpWindow:
<MainWindow>:
name:"main"
FloatLayout:
#Background
Widget:
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: "Images/logo_br.png"
Button:
size_hint: 0.06, 0.06
pos_hint: {"x":.945, "y":.945}
text: 'X'
background_color: 1,0,0,.6
on_release:
app.stop()
#Logo/Credit
Image:
source: 'Images/dtd.png'
allow_stretch: True
size_hint: 0.2, 0.2
pos_hint: {"x":0.01, "y":0.77}
Label:
text:"Job Assigner"
bold:True
italic:True
size: self.texture_size
pos_hint: {"x":-0.39, "y":0.25}
color: 1,1,1,1
Label:
text:"Created by: Anthony DeArmas"
bold:True
italic:True
size: self.texture_size
pos_hint: {"x":0.35, "y":-0.46}
color: 0,0,0,.2
#Main Menu Buttons
Image:
source: 'Images/icon_cog.png'
allow_stretch: True
size_hint: 0.04, 0.04
pos_hint: {"x":0.23, "y":0.53}
Button:
size_hint: 0.3, 0.1
pos_hint: {"x":0.15, "y":0.5}
text: 'Settings'
background_color: 1,1,1,.6
on_release:
app.root.current = "settings"
root.manager.transition.direction = 'left'
Image:
source: 'Images/icon_qmark.png'
allow_stretch: True
size_hint: 0.03, 0.03
pos_hint: {"x":0.7, "y":0.535}
Button:
size_hint: 0.3, 0.1
pos_hint: {"x":0.6, "y":0.5}
text: 'Help'
background_color: 1,1,1,.6
on_release:
app.root.current = "help"
root.manager.transition.direction = 'left'
Image:
source: 'Images/icon_notepad.png'
allow_stretch: True
size_hint: 0.035, 0.035
pos_hint: {"x":0.442, "y":0.335}
Button:
size_hint: 0.3, 0.1
pos_hint: {"x":0.377, "y":0.3}
text: 'Assign Jobs'
on_press: root.assign_Jobs()
background_color: 1,1,1,.6
<SettingsWindow>:
name:"settings"
FloatLayout:
Widget:
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: "Images/logo_br.png"
Color:
rgba: 1,1,1,.3
Rectangle:
size: 200, 500
pos: self.width/10, self.height/7
Color:
rgba: 0,0,0,.5
Rectangle:
size: 190, 350
pos: self.width/9.4, self.height/3
ScrollView:
GridLayout:
cols:1
size_hint: None, None
height: self.minimum_height
pos_hint: {"x":0.125, "y":0.1}
Label:
size_hint: None, None
size: self.texture_size
text: root.pretty_list_people * 20
Button:
text:"Back"
size_hint: 0.1, 0.1
pos_hint: {"x":0, "y":0}
background_color: 1,1,1,.6
on_release:
app.root.current = "main"
root.manager.transition.direction = 'right'
Label:
text: "People"
font_size: 30
italic: True
pos_hint: {"x":-0.275, "y":0.45}
color: 0,0,0,1
Button:
text:"Update"
size_hint: 0.25, 0.1
pos_hint: {"x":0.1, "y":0.144}
on_press: root.Pretty_Print_People(root.get_People())
Button:
text:"Add"
size_hint: 0.125, 0.09
pos_hint: {"x":0.1, "y":0.243}
#on_press: root.Pretty_Print_People(root.get_People())
Button:
text:"Remove"
size_hint: 0.125, 0.09
pos_hint: {"x":0.225, "y":0.243}
#on_press: root.Pretty_Print_People(root.get_People())
<HelpWindow>:
name:"help"
FloatLayout:
Widget:
canvas.before:
Rectangle:
pos: self.pos
size: self.size
source: "Images/logo_br.png"
Button:
text:"Back"
size_hint: 0.1, 0.1
pos_hint: {"x":0, "y":0}
background_color: 1,1,1,.6
on_release:
app.root.current = "main"
root.manager.transition.direction = 'right'
我正在發布找到的解決方案。 這很愚蠢,但我只是找不到pos提示的正確語法。 這是我的滾動視圖kv代碼:
ScrollView:
size_hint: (None, None)
size: (150, 325)
pos_hint: {'center_x': .23, 'center_y': .62}
Label:
size_hint: None, None
size: self.texture_size
text: root.pretty_list_people * 20
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.