当前位置:网站首页>Kivy教程之 更改背景颜色(教程含源码)
Kivy教程之 更改背景颜色(教程含源码)
2022-07-04 03:53:00 【知识大胖】
我们将调整窗口背景颜色。窗口背景(OpenGL 渲染器的“清晰颜色”)是全局Window对象的属性。为了更改它,我们在以下__name__ == 'main’行之后添加此代码main.py:
from kivy.core.window import Window
from kivy.utils import get_color_from_hex
Window.clearcolor = get_color_from_hex('#101216')
实战代码

import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.utils import get_color_from_hex
#Window.clearcolor = [1, 1, 1, 1]
Window.clearcolor = get_color_from_hex("#ffffff")
kvcode = """
#:import C kivy.utils.get_color_from_hex
<[email protected]>:
size_hint: .2, .3
canvas.before:
Color:
rgba: C("#22FFAA")
Rectangle:
pos: self.pos
size: self.size
FloatLayout:
FVerde:
pos_hint:{"x":.4, "y":.4}
"""
class JanelaApp(App):
def build(self):
return Builder.load_string(kvcode)
janela = JanelaApp()
janela.run()
边栏推荐
- Flink learning 6: programming model
- RHCSA 01 - 创建分区与文件系统
- Redis:集合Set类型数据的操作命令
- Redis:有序集合zset类型数据操作命令
- Select function variable column name in dplyr of R language
- How to telecommute more efficiently | community essay solicitation
- Leader: who uses redis expired monitoring to close orders and get out of here!
- NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
- 浅谈一篇优质的小红书文案需要具备什么
- Rhcsa 04 - process management
猜你喜欢

96% of the collected traffic is prevented by bubble mart of cloud hosting

Virtual commodity account trading platform source code_ Support personal QR code collection

Redis:集合Set类型数据的操作命令

dried food! Generation of rare samples based on GaN

微信公众号无限回调授权系统源码

架构实战营 - 第 6 期 模块九之毕业设计

什么是上下文?

NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon

Select function variable column name in dplyr of R language

Architecture practice camp - graduation project of module 9 of phase 6
随机推荐
Touch and take you to implement an EventEmitter
普源DS1000Z系列数字示波器在通信原理实验中的应用方案
The interactive solution of JS and app in the H5 page embedded in app (parameters can be transferred and callbacks can be made)
Unity draws the trajectory of pinball and billiards
Dry goods | detailed explanation of webshell Foundation
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
Graduation project
C语言双向链表初版
I.MX6U-ALPHA开发板(模仿STM32驱动开发实验)
微信公众号无限回调授权系统源码
Restore the subtlety of window position
最长递增子序列问题(你真的会了吗)
Emlog user registration plug-in is worth 80 yuan
MIN_RTO 对话
leetcode刷题:二叉树04(二叉树的层序遍历)
Pytest基础自学系列(一)
(指针)编写函数void fun(int x,int *pp,int *n)
Programmers' telecommuting is mixed | community essay solicitation
旭化成首次参展第五届中国国际进口博览会(5th CIIE)
What does software testing do? Find defects and improve the quality of software