当前位置:网站首页>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:边栏推荐
- 每日一题之干草堆的移动
- Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
- [shutter] image component (configure local GIF image resources | load placeholder with local resources)
- Lex & yacc & bison & flex configuration problems
- 数据分析思维分析犯法和业务知识——分析方法(一)
- Test shift right: Elk practice of online quality monitoring
- 深度剖析数据在内存中的存储
- JS inheritance and prototype chain
- 链表中的节点每k个一组翻转
- leetcode-2280:表示一个折线图的最少线段数
猜你喜欢

excel表格计算时间日期的差值,并转化为分钟数

数学建模之线性规划(含MATLAB代码)

Explain the basic concepts and five attributes of RDD in detail

研发一款国产ARM智能边缘计算网关需要什么

12_ Implementation of rolling automatic video playback effect of wechat video number of wechat applet

Test shift right: Elk practice of online quality monitoring

攻克哈希的基本概念与实现

无向图的割点

【爱死机】《吉巴罗》被忽略的细节

数据分析思维分析犯法和业务知识——分析方法(一)
随机推荐
matlab 多普勒效应产生振动信号和处理
删除有序链表中重复的元素-II
(C语言)数据的存储
Vulkan is not a "panacea"“
2022.2.14 resumption
[case sharing] let the development of education in the new era advance with "number"
leetcode-2280:表示一个折线图的最少线段数
Understanding and distinguishing of some noun concepts in adjustment / filtering
How to convert Quanzhi a40i/t3 to can through SPI
瑞萨RZ/G2L 处理器简介|框架图|功耗|原理图及硬件设计指南
[AUTOSAR eight OS]
Machine learning: numpy version linear regression predicts Boston house prices
用Go+绘制爱心给心爱的她表白
Draw love with go+ to express love to her beloved
有向图的强连通分量
[shutter] image component (configure local GIF image resources | load placeholder with local resources)
12_ Implementation of rolling automatic video playback effect of wechat video number of wechat applet
[overview of AUTOSAR three RTE]
全志A40i/T3如何通过SPI转CAN
机器学习术语