Skip to main content

Decorator for Fast Generation of Function Input Output Components

Project description

一、前言

本模块灵感来源于magicgui,感谢作者 本模块与magicgui的区别:

  • 本模块主要基于tkinter,以及python标准库中的typing、ctypes。不需要安装pyside等其他第三方依赖。
  • 本模块本着简易使用的原则,只有一个装饰器函数,没有其他参数设置
  • 生成的输出组件与返回值数量一致

二、功能

函数装饰器

  • 1、可以根据函数的参数,设置输入组件
  • 2、根据函数的返回值,设置输出组件
  • 3、run按钮运行函数,并输出结果
  • 4、tkinter进行了DPI的适配,界面不会显示模糊

三、使用方法

pip install defgui

直接在函数上加上装饰器就可以使用

注意:

  • 1、函数的参数需要带类型标识,否则报错
  • 2、类型标识目前支持:int、float、str、List[str]
from defgui import defgui
from typing import List

@defgui
def example_function(a: int, b: float,c: str,d: List[str])-> tuple:
	"""Example function that returns a tuple of four values."""
	return a + 1, b + 1,"返回字符串:%s"%(c),d

# 运行函数
example_function()

png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

defgui-0.1.tar.gz (4.7 kB view details)

Uploaded Source

File details

Details for the file defgui-0.1.tar.gz.

File metadata

  • Download URL: defgui-0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for defgui-0.1.tar.gz
Algorithm Hash digest
SHA256 fb15147d4a788d1d4b5d1ba1b16d402a8257431532ce1d530e8a957e704fffc7
MD5 61f0606d01f69bee6f133e3629684a91
BLAKE2b-256 bb8e8429615a0b54bd97df901d0aaf561ac2e3fa795c434190e8a2556f416340

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page