当前位置:网站首页>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()
边栏推荐
- Redis: order collection Zset type data operation command
- Unity资源路径
- Rhcsa 01 - create partitions and file systems
- Leetcode skimming: binary tree 04 (sequence traversal of binary tree)
- B. All Distinct
- A beautiful API document generation tool
- MySQL JDBC编程
- 【云原生】那些看起来很牛X,原理却很简单的一行代码
- dried food! Generation of rare samples based on GaN
- 仿《游戏鸟》源码 手游发号评测开服开测合集专区游戏下载网站模板
猜你喜欢

毕业设计项目

软件测试是干什么的 发现缺陷错误,提高软件的质量

虚拟商品帐号交易平台源码_支持个人二维码收款

Balloon punching and Boolean operation problems (extremely difficult)

Main applications of TDK lambda power supply

R语言dplyr中的Select函数变量列名

【愚公系列】2022年7月 Go教学课程 001-Go语言前提简介

leetcode刷题:二叉树04(二叉树的层序遍历)

苹果CMS仿西瓜视频大气响应式视频模板源码

2020 Bioinformatics | TransformerCPI
随机推荐
[webrtc] M98 Ninja build and compile instructions
Wechat official account infinite callback authorization system source code
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
戳气球和布尔运算问题(巨难)
Common methods of threads
Leetcode skimming: binary tree 09 (minimum depth of binary tree)
Unity draws the trajectory of pinball and billiards
ModStartBlog 现代化个人博客系统 v5.2.0 源码下载
Small record of thinking
leetcode刷题:二叉树08(N叉树的最大深度)
陪驾注意事项 这23点要注意!
Leetcode skimming: binary tree 04 (sequence traversal of binary tree)
资深开发人员告诉你,怎样编写出优秀的代码?
RHCSA 08 - automount配置
MIN_RTO 对话
Main applications of TDK lambda power supply
What does software testing do? Find defects and improve the quality of software
普源DS1000Z系列数字示波器在通信原理实验中的应用方案
Boutique website navigation theme whole station source code WordPress template adaptive mobile terminal
Emlog用户注册插件 价值80元