【发布时间】:2018-01-18 10:26:52
【问题描述】:
嗨,这里是我的一个简单 RSTDocument 编辑器的代码。
我正在尝试使用弹出窗口中的滑块更改 RSTdocument 的基本字体大小。我怎样才能做到这一点 ??我尝试使用slider_id.value,但没有成功。
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.popup import Popup
Builder.load_string('''
<RST_GUI>:
padding: 5
spacing: 2
orientation: 'vertical'
BoxLayout:
size_hint: (.5, .1)
pos_hint: {'center_x': .5, 'center_y': 0.5}
Button:
text: 'Font Size'
on_press: root.font_size()
BoxLayout:
TextInput:
id: textinput
tab_width: 5
Splitter:
sizeable_from: 'right'
min_size: '5'
RstDocument:
show_errors: True
base_font_size: #slider_id.value or something possible?
text: textinput.text
<font_size>:
size_hint: (.5, .3)
pos_hint: {'center_x': .5, 'center_y': 0.5}
title: " Font size: " + str(slider_id.value)
Slider:
min: 20
max: 50
value:31
step: 1
id: slider_id
''')
class RST_GUI(BoxLayout):
def font_size(self):
font_size().open()
class font_size(Popup):
pass
class RST(App):
def build(self):
return RST_GUI()
if __name__ == '__main__':
RST().run()
【问题讨论】:
标签: popup slider kivy python-3.5