Skip to main content

tkparam provides a simple way to dynamically adjust parameters in a tkinter GUI panel, which is useful in looping programs

Project description

tkparam

tkparam提供了一种简单的方法使用tkinter的GUI面板中来动态调整参数,方便在循环程序中调整参数。
tkparam provides a simple way to dynamically adjust parameters in a tkinter GUI panel, which is useful in looping programs.

安装 Installation

使用pip安装:
Install through pip:

pip install tkparam

用例 Example

import tkparam
import time

# 创建个tk窗口,窗口在线程中运行
# create a tkinter window running in a thread
window = TKParamWindow(title="example window")

# 定义窗口中需要调整的参数
# define parameters to be adjusted in the window
float_param = window.get_scalar("float param", default_value=2, range_min=-1.5, range_max=2.3)
int_param = window.get_scalar("int param", default_value=2.3, range_min=-10, range_max=10, is_int=True)
bool_button = window.get_button("button", default_value=False, on_change=lambda status: print(f"Button clicked: status: {status}"))

loop_duration = 10
print(f"The program will enter a loop for {loop_duration} seconds, you can adjust the parameters in GUI and see the printed real-time value")
end_time = time.time() + loop_duration

while True:
    print(f"{float_param} | {int_param} | {bool_button}")
    if time.time() > end_time:
        break

# 退出窗口,自动结束线程
# quit the window and end the thread automatically
window.quit()

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

tkparam-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tkparam-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file tkparam-0.1.1.tar.gz.

File metadata

  • Download URL: tkparam-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tkparam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c3157319ebe4a6537d0c611056dc02f196507df8f97796638752adb8b51c4fcf
MD5 8cbde741840b44794e472e6171a49027
BLAKE2b-256 1430ca01b7067b013d2fc1bc4f46ba5721ffb2d2f29b8577a6362d8bfa342a5c

See more details on using hashes here.

File details

Details for the file tkparam-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tkparam-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tkparam-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7caea0c5a8cf2db49f8224a36cf637318eb50205d9f780a51d177a990caa4d89
MD5 c57fbe4c3b6bbba1488ca697a364aaa6
BLAKE2b-256 d9fd172fc4fe3df1cf1371e87cbc889d247141f40115b0ec2c8762d8805b77f7

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