当前位置:网站首页>Kivy教程大全之如何在 Kivy 中创建下拉列表
Kivy教程大全之如何在 Kivy 中创建下拉列表
2022-07-03 00:46:00 【知识大胖】
下面我提供了一个使用 ScreenManager 在 Kivy 中创建下拉列表的示例。请注意,这适用于所有布局,但我发现 GridLayout 是最容易控制的。您可以将其复制并粘贴到您的代码中。
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
Builder.load_file("try_out_app.kv")
class ExampleScreen(Screen):
pass
class RootWidget(ScreenManager):
pass
class Demo(App):
def build(self):
return RootWidget()
if __name__ == "__main__":
Demo().run()
界面
<ExampleScreen>:
name: "example_screen"
GridLayout:
cols: 1
padding: 100, 20
size_hint: 0.5, 0.5
Button:
id: btn
text: "select"
size_hint: None, None
on_parent: drop_content.dismiss()
on_release: drop_content.open(self)
DropDown:
边栏推荐
猜你喜欢
leetcode:871. Minimum refueling times [Pat has done before + maximum stacking + greed]
全志A40i/T3如何通过SPI转CAN
RISA rz/g2l processor introduction | frame diagram | power consumption | schematic diagram and hardware design guide
[AUTOSAR II appl overview]
【C语言】分支和循环语句(上)
深度剖析数据在内存中的存储
Strongly connected components of digraph
1696C. Fishingprince Plays With Array【思维题 + 中间状态 + 优化存储】
How to systematically learn machine learning
Explain the basic concepts and five attributes of RDD in detail
随机推荐
12_ Implementation of rolling automatic video playback effect of wechat video number of wechat applet
Excel calculates the difference between time and date and converts it into minutes
18_微信小程序之微信视频号滚动自动播放视频效果实现2.0
First hand evaluation of Reza electronics rz/g2l development board
每日一题之干草堆的移动
这不平凡的两年,感谢我们一直在一起!
JS inheritance and prototype chain
攻克哈希的基本概念与实现
Foundations of data science is free to download
Tensorflow 2. Chapter 15 of X (keras) source code explanation: migration learning and fine tuning
tail -f 、tail -F、tailf的区别
Rk3568 development board evaluation (II): development environment construction
leetcode-2115:从给定原材料中找到所有可以做出的菜
(C语言)数据的存储
飞凌搭载TI AM62x的ARM核心板/开发板首发上市,亮相Embedded World 2022
[AUTOSAR 11 communication related mechanism]
指针进阶(一)
leetcode-224:基本计算器
How to convert Quanzhi a40i/t3 to can through SPI
[AUTOSAR eight OS]