2025-09-02
Python
00

只是个人学习的时候的一些笔记,如果有什么错误的地方还请各位勿喷,手下留情,期待您的指正。 定期会更新文章到www.sea-whales.cn我的个人网站中,有兴趣的小伙伴可以进来看看

目录

【Kivy】布局 FloatLayout、BoxLayout [学习分享](二)

【Kivy】布局 AnchorLayout、GridLayout [学习分享](三)

【Kivy】布局 PageLayout、RelativeLayout [学习分享](四)

【Kivy】布局 ScatterLayout 、StackLayout [学习分享](五)

布局

FloatLayout

py文件

python
# !/usr/bin/env python3 # -*- coding: utf-8 -*- from kivy.app import App from kivy.uix.floatlayout import FloatLayout class FloatLayoutWidget(FloatLayout): def __init__(self): super(FloatLayoutWidget, self).__init__() class FloatLayoutApp(App): def build(self): return FloatLayoutWidget() if __name__ == '__main__': FloatLayoutApp().run()
2025-09-02
Python
00

只是个人学习的时候的一些笔记,如果有什么错误的地方还请各位勿喷,手下留情,期待您的指正。 定期会更新文章到blog.sea-whales.cn我的个人网站中,有兴趣的小伙伴可以进来看看

旋转、平移和缩放空间坐标

在canvas 中是可以使用Rotate指令来控制旋转操作,他与ScatterLayout布局不同,它是对整个坐标空间,因此所有的子部件都是会受到影响。在使用整个参数时,需要指定三个参数;

  • axis: 设置用于旋转的轴,通常为z轴(0,0,1)
  • angle: 设置旋转度数
  • origin: 设置旋转参考点

来试试效果:

python
# !/usr/bin/env python3 # -*- coding: utf-8 -*- # 选择平移缩放 from kivy.uix.gridlayout import GridLayout from kivy.app import App class RotateGridLayoutWidget(GridLayout): def __init__(self, **kwargs): super(RotateGridLayoutWidget, self).__init__(**kwargs) class RotateTranslateZoomApp(App): def build(self): return RotateGridLayoutWidget() if __name__ == '__main__': RotateTranslateZoomApp().run()
2025-09-02
Python
00

只是个人学习的时候的一些笔记,如果有什么错误的地方还请各位勿喷,手下留情,期待您的指正。 定期会更新文章到blog.sea-whales.cn我的个人网站中,有兴趣的小伙伴可以进来看看

实战--画板

我们先来做一个初始画板,先不添加其他复杂元素,来实现能写字的功能:

python
# !/usr/bin/env python3 # -*- coding: utf-8 -*- from kivy.app import App from kivy.uix.widget import Widget from kivy.graphics import Line, Color class DrawCanvasWidget(Widget): def __init__(self, **kwargs): super(DrawCanvasWidget, self).__init__(**kwargs) """设置画笔的默认颜色为黑色""" self.canvas.add(Color(rgb=[0, 0, 0])) self.line_width = 2 def on_touch_down(self, touch): """触摸显示轨迹""" if Widget.on_touch_down(self, touch): return with self.canvas: touch.ud['current_line'] = Line(points=(touch.x, touch.y), width=self.line_width) def on_touch_move(self, touch): """连线""" if 'current_line' in touch.ud: touch.ud['current_line'].points += (touch.x, touch.y) class PaintApp(App): def build(self): self.draw_canvas_widget = DrawCanvasWidget() return self.draw_canvas_widget if __name__ == '__main__': PaintApp().run()
2025-09-02
Python
00

当你在安装 mysqlclient 时遇到 Exception: Can not find valid pkg-config name. 错误,通常是因为系统缺少必要的开发库或环境变量未正确设置。以下是解决这个问题的步骤:

1. 安装 MariaDB 开发库

确保你已经安装了 MariaDB 的开发库。根据你的操作系统,使用相应的包管理器来安装这些库。

Ubuntu/Debian

bash
sudo apt-get update sudo apt-get install python3-dev default-libmysqlclient-dev libssl-dev

CentOS/RHEL

bash
sudo yum install python3-devel mariadb-devel
2025-09-02
Linux
00

alist 中的磁盘挂载到linux

在 Linux 系统中,你可以将 AList 管理的存储(如本地磁盘、SMB/NFS 共享、云存储等)挂载到本地文件系统,使其像普通目录一样访问。以下是几种实现方法: