Python 有没有一种方法可以在Kivy中创建一个左侧有3个文本输入字段,右侧有1个长文本输入的GUI?
有没有一种方法可以在Kivy中创建一个左侧有3个文本输入字段,右侧有1个长文本输入的GUI?图像和代码如下所示: 我的代码:Python 有没有一种方法可以在Kivy中创建一个左侧有3个文本输入字段,右侧有1个长文本输入的GUI?,python,kivy,Python,Kivy,有没有一种方法可以在Kivy中创建一个左侧有3个文本输入字段,右侧有1个长文本输入的GUI?图像和代码如下所示: 我的代码: <CalcScreen>: GridLayout: cols: 1 GridLayout: cols: 1 Button: text: "Board Foot Calculator" bo
<CalcScreen>:
GridLayout:
cols: 1
GridLayout:
cols: 1
Button:
text: "Board Foot Calculator"
bold: True
background_normal: 'rosewood.png'
background_down: 'rosewood.png'
GridLayout:
cols: 2
TextInput:
input_type: 'number'
id: length
hint_text: "Length in Inches"
TextInput:
id: mainlist
TextInput:
input_type: 'number'
id: width
hint_text: "Width in Inches"
TextInput:
input_type: 'number'
id: thickness
hint_text: "Thickness in Inches"
:
网格布局:
科尔斯:1
网格布局:
科尔斯:1
按钮:
文字:“板脚计算器”
黑体字:对
背景:正常:“rosewood.png”
背景:“rosewood.png”
网格布局:
科尔斯:2
文本输入:
输入类型:“数字”
id:长度
提示文字:“长度单位为英寸”
文本输入:
id:mainlist
文本输入:
输入类型:“数字”
id:宽度
提示文字:“以英寸为单位的宽度”
文本输入:
输入类型:“数字”
id:厚度
提示文字:“以英寸为单位的厚度”
编辑:
我尝试使用GridLayout cols:2,但它使顶部非常大,而下面的按钮非常小。另外,它不是我想要的格式。下图还显示了一幅图像:
您可以结合使用
BoxLayouts
来实现:
<CalcScreen>:
GridLayout:
cols: 1
GridLayout:
cols: 1
Button:
text: "Board Foot Calculator"
bold: True
background_normal: 'rosewood.png'
background_down: 'rosewood.png'
BoxLayout: # contains two items, the BoxLayout below and the long TextInput
orientation: 'horizontal'
BoxLayout: # contains the three TextInputs on the left
orientation: 'vertical'
TextInput:
input_type: 'number'
id: length
hint_text: "Length in Inches"
TextInput:
input_type: 'number'
id: width
hint_text: "Width in Inches"
TextInput:
input_type: 'number'
id: thickness
hint_text: "Thickness in Inches"
TextInput: # this is the long TextInput on the right
id: mainlist
:
网格布局:
科尔斯:1
网格布局:
科尔斯:1
按钮:
文字:“板脚计算器”
黑体字:对
背景:正常:“rosewood.png”
背景:“rosewood.png”
BoxLayout:#包含两项,下面的BoxLayout和长文本输入
方向:“水平”
BoxLayout:#包含左侧的三个文本输入
方向:“垂直”
文本输入:
输入类型:“数字”
id:长度
提示文字:“长度单位为英寸”
文本输入:
输入类型:“数字”
id:宽度
提示文字:“以英寸为单位的宽度”
文本输入:
输入类型:“数字”
id:厚度
提示文字:“以英寸为单位的厚度”
TextInput:#这是右边的长TextInput
id:mainlist
它没有正确复制粘贴,所以我只是更改了随机内容:\n确实如此,但顶部太大了。我的代码看起来像现在。您只需在大的按钮中添加大小\u提示\u y:0.2
。