提交 70315bf5 编写于 作者: 小康2022's avatar 小康2022 👍

version 2.5.10.4

上级 d2ad9d71
......@@ -5,8 +5,8 @@
Update/最近更新
--------------
> Version: 2.5.10.3
> Date: 2023/02/11
> Version: 2.5.10.4
> Date: 2023/03/12
### Features/新增
......@@ -29,6 +29,9 @@ Update/最近更新
- [X] Optimize the solution to the adaptive DPI problem
优化解决适配 DPI 问题的方案
- [X] Optimized the way font size fits DPI
优化了字体大小适配 DPI 的方式
> 更多信息见更新日志: [CHANGELOG](./CHANGELOG.md)
Description/模块描述
......@@ -85,8 +88,8 @@ The `tkintertools` module is an auxiliary module of the `tkinter` module
* `Compatible Version` folder contains the latest compatible version, which is compatible with python 3.7
`Compatible Version`文件夹里面是当前最新版本的兼容版本,可兼容python3.7版本
> 兼容版本: [Compatible Version](./Compatible%20Version/)
过去版本: [Release Version](./Release%20Version/)
> 兼容版本: [Compatible Version](./Compatible%20Version/)
> 过去版本: [Release Version](./Release%20Version/)
### More/更多
......
......@@ -4,12 +4,12 @@
import sys
if sys.version_info < (3, 11):
raise RuntimeError('\033[31mPython版本低于3.10,无法运行测试程序\033[0m')
raise RuntimeError('\033[31mPython version is too low\033[0m')
from math import cos, pi
from random import randint
from tkinter import TclError, messagebox
from tkinter import Menu, TclError, messagebox
from winsound import Beep
import tkintertools as tkt
......@@ -55,9 +55,10 @@ def shutdown() -> None:
root.quit() # 退出测试程序
tkt.SetProcessDpiAwareness()
root = tkt.Tk('测试程序', 1280, 720, shutdown=shutdown)
root = tkt.Tk('tkintertools - 测试程序', 1280, 720, shutdown=shutdown)
root.minsize(640, 360)
menu = Menu(root, tearoff=False)
root.configure(menu=menu)
canvas_main = tkt.Canvas(root, 1280, 720)
canvas_main.place(x=0, y=0)
canvas_doc = tkt.Canvas(root, 1280, 720)
......@@ -69,6 +70,11 @@ canvas_graph.place(x=1280, y=0)
def sound(): return Beep(600, 100)
m = Menu(menu, tearoff=False)
menu.add_cascade(menu=m, label='帮助(H)')
m.add_command(label='关于', accelerator='Ctrl+A')
tkt.CanvasButton(
canvas_main, 10, 660, 200, 50, 0, '模块文档',
command=lambda: (tkt.move(root, canvas_main, 1280*canvas_main.rate_x, 0, 500, 'rebound'),
......@@ -127,7 +133,7 @@ load.command_ex['press'] = sound
bar = tkt.ProcessBar(canvas_main, 320, 320, 640, 35)
canvas_doc.create_text( # 模块说明文档
15, 360, text=tkt.__doc__, font=tkt.font('consolas', 17, 'italic'), anchor='w')
15, 360, text=tkt.__doc__, font=('consolas', 16, 'italic'), anchor='w')
try: # 加载图片
canvas_graph.create_image(
......@@ -135,4 +141,5 @@ try: # 加载图片
except TclError: # 缺少图片
print('\033[31m缺少示例图片tkinter.png\033[0m')
tkt.SetProcessDpiAwareness()
root.mainloop() # 消息事件循环
......@@ -42,7 +42,7 @@ from fractions import Fraction # 图片缩放
from typing import Generator, Iterable, Literal, Self, Type # 类型提示
__author__ = 'Xiaokang2022'
__version__ = '2.5.10.3'
__version__ = '2.5.10.4'
__all__ = [
'Tk',
'Toplevel',
......@@ -73,9 +73,8 @@ COLOR_BAR = '#E1E1E1', '#06b025' # 默认的
BORDERWIDTH = 1 # 默认控件外框宽度
CURSOR = '│' # 文本光标
FONT = '楷体' # 默认字体
_SIZE = 24 # 默认字体大小
SIZE = round(_SIZE/SCALE) # 默认字体大小(适配DPI)
FONT = '楷体' # 默认字体
SIZE = 24 # 默认字体大小
LIMIT = -1 # 默认文本长度
RADIUS = 0 # 默认控件圆角半径
FRAMES = 60 # 默认帧数
......@@ -1384,7 +1383,7 @@ def color(
return '#%06X' % _rgb
def font(family: str = FONT, size: int = _SIZE, *args: str) -> tuple:
def font(family: str = FONT, size: int = SIZE, *args: str) -> tuple:
"""
### 字体函数
字体大小将自动适配 DPI 级别\n
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册