当前位置:网站首页>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()
边栏推荐
- 博朗与Virgil Abloh于2021年为纪念博朗品牌100周年而联合打造的“功能性艺术”将在博物馆展出Abloh作品期间首次亮相
- Programmers' telecommuting is mixed | community essay solicitation
- What does software testing do? Find defects and improve the quality of software
- Rhcsa 04 - process management
- Rhcsa 06 - suid, sgid, sticky bit (to be added)
- 【微信小程序】好看的轮播图组件
- JS realizes the effect of text scrolling marquee
- Asynchronous development process - touch your hand and lead you to realize a promise
- Leetcode skimming: binary tree 08 (maximum depth of n-ary tree)
- Unity Resource path
猜你喜欢
Emlog user registration plug-in is worth 80 yuan
北漂程序员,月薪20K,一年攒15W,正常吗?
R语言中如何查看已安装的R包
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
Architecture training graduation design + summary
虚拟商品帐号交易平台源码_支持个人二维码收款
Application scheme of Puyuan ds1000z series digital oscilloscope in communication principle experiment
毕业设计项目
普源DS1000Z系列数字示波器在通信原理实验中的应用方案
Architecture practice camp - graduation project of module 9 of phase 6
随机推荐
一位毕业生的自我分享
Redis:哈希hash类型数据操作命令
仿《游戏鸟》源码 手游发号评测开服开测合集专区游戏下载网站模板
(pointeur) Écrivez - vous une fonction qui compare la taille de la chaîne et fonctionne comme strcmp.
Parameterization of controls in katalon
Small record of thinking
[microservices openfeign] two degradation methods of feign | fallback | fallbackfactory
Leetcode brush question: binary tree 06 (symmetric binary tree)
RHCSA 03 - 文件的基础权限
Rhcsa 01 - create partitions and file systems
Ppt tutorial, how to save a presentation as a PDF file in PowerPoint?
[microservice openfeign] @feignclient detailed explanation
Use NRM and NVM to manage your NPM source and node versions
ctf-pikachu-XSS
普源DS1000Z系列数字示波器在通信原理实验中的应用方案
Flink learning 8: data consistency
Architecture training graduation design + summary
【微信小程序】好看的轮播图组件
Configuration and hot update of nocturnal simulator in hbuildx
R语言中如何查看已安装的R包