【发布时间】:2019-01-22 18:02:51
【问题描述】:
python 布局的相同代码返回不同的 GUI。我很困惑:
# ---------- VQCIA.kv ----------
VQCIA:
<VQCIA>:
orientation: "vertical"
goi: goi
padding: 10
spacing: 10
size: 400, 200
pos: 200, 200
size_hint:None,None
BoxLayout:
Label:
text: "Enter gene of interest with TAIR ID:"
font_size: '25sp'
BoxLayout:
TextInput:
hint_text: 'AT3G20770'
multiline: False
font_size: '25sp'
id: goi
BoxLayout:
Button:
text: "Submit"
size_hint_x: 15
on_press: root.submit_goi()
# ---------- vqcia.py ----------
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
class VQCIA(BoxLayout):
# Connects the value in the TextInput widget to these
# fields
goi = ObjectProperty()
def submit_goi(self):
# Get the student name from the TextInputs
goi = self.goi.text
print goi
return
class VQCIAApp(App):
def build(self):
return VQCIA()
dbApp = VQCIAApp()
dbApp.run()
我的实验室计算机是带有 Kivy==1.10.1 的 macOS Sierra 10.12.6 并且具有理想的输出:
另一方面,我的个人 Mac macOS high Sierra 10.13.6 with Kivy==1.10.1 输出错误:
会发生什么?
【问题讨论】:
-
你明白,经常收到支票和取消支票是不舒服的,我认为它很吵,它会消除帮助你的愿望,避免吵闹。
-
对此感到抱歉。我是使用堆栈溢出的新手。我以为我可以接受多个答案,但后来我意识到,一旦我接受一个答案,它就会取消另一个答案。再次抱歉。
-
如果您有其他问题,请不要在 cmets 部分进行,它们仅用于讨论当前问题,如果您有其他问题,请创建新的 POST,如果您不想引起更多问题,阅读How to Ask并通过tour
-
感谢您的建议。抱歉操作不当。