Saravanan666/pypi-org huggingface dataset:
Package: tk-dragtool
NAMEtk_dragtoolDESCRIPTION 简介提供用鼠标拖动、缩放tkinter控件工具的模块。
A module which supplies tools to drag and resize
tkinter window and widgets with the mouse.FUNCTIONS 函数bind_drag(tkwidget, dragger)绑定拖曳事件。
tkwidget: 被拖动的控件或窗口,
dragger: 接收鼠标事件的控件,
调用bind_drag后,当鼠标拖动dragger时, tkwidget会被带着拖动, 但dragger
作为接收鼠标事件的控件, 位置不会改变。
x 和 y: 作用同上。bind_resize(tkwidget, dragger, anchor, min_w=0, min_h=0, move_dragger=True)绑定缩放事件。
anchor: 缩放的方位, 取值为N,S,W,E,NW,NE,SW,SE,分别表示东、西、南、北。
min_w,min_h: 该方向tkwidget缩放的最小宽度(或高度)。
move_dragger: 缩放时是否移动dragger。
其他说明同bind_drag函数。draggable(tkwidget)调用draggable(tkwidget) 使tkwidget可拖动。
tkwidget: 一个控件(Widget)或一个窗口(Wm)。
x 和 y: 只允许改变x坐标或y坐标。getpos()获取鼠标当前位置。move(widget, x=None, y=None, width=None, height=None)移动控件或窗口widget, 参数皆可选。EXAMPLES 示例importtkinterastkfromtk_dragtoolimportdraggableroot=tk.Tk()btn=tk.Button(root,text="Drag")draggable(btn)btn.place(x=0,y=0)root.mainloop()运行效果:更复杂的示例, 实现了8个缩放手柄的功能:btns=[]# 用btns列表存储创建的按钮defadd_button(func,anchor):# func的作用是计算按钮新坐标b=ttk.Button(root)b._func=funcbind_resize(btn,b,anchor)x,y=func()b.place(x=x,y=y,width=size,height=size)b.bind('<B1-Motion>',adjust_button,add='+')btns.append(b)defadjust_button(event=None):# 改变大小或拖动后,调整手柄位置forbinbtns:x,y=b._func()b.place(x=x,y=y)root=tk.Tk()root.title("Test")root.geometry('500x350')btn=ttk.Button(root,text="Button")draggable(btn)btn.bind('<B1-Motion>',adjust_button,add='+')x1=20;y1=20;x2=220;y2=170;size=10btn.place(x=x1,y=y1,width=x2-x1,height=y2-y1)root.update()# 创建各个手柄, 这里是控件缩放的算法add_button(lambda:(btn.winfo_x()-size,btn.winfo_y()-size),'nw')add_button(lambda:(btn.winfo_x()+btn.winfo_width()//2,btn.winfo_y()-size),'n')add_button(lambda:(btn.winfo_x()+btn.winfo_width(),btn.winfo_y()-size),'ne')add_button(lambda:(btn.winfo_x()+btn.winfo_width(),btn.winfo_y()+btn.winfo_height()//2),'e')add_button(lambda:(btn.winfo_x()+btn.winfo_width(),btn.winfo_y()+btn.winfo_height()),'se')add_button(lambda:(btn.winfo_x()+btn.winfo_width()//2,btn.winfo_y()+btn.winfo_height()),'s')add_button(lambda:(btn.winfo_x()-size,btn.winfo_y()+btn.winfo_height()),'sw')add_button(lambda:(btn.winfo_x()-size,btn.winfo_y()+btn.winfo_height()//2),'w')root.mainloop()效果图:作者:七分诚意 qq:3076711200 百度贴吧账号:qfcy_作者CSDN主页:https://blog.csdn.net/qfcy_/
Package: tkdraw
A simple draw GUI for Python3.CONTENTThis python3 package contains two modules that were developed as easy to use
graphical libraries for programming beginners or for people who just wish to
easily draw simple graphical objects in a window. They are based on the tkinter
canvas object, but unlike tkinter they are synchronous.The main module istkdraw.screen. It is synchronous, which means that you
don't have to handle asynchronous calls to predefined functions to react to the
interface events. It provides the classtkdraw.screen.Screenthat opens a
tkinter window containing a canvas where you can draw a rectangular board
containing pieces, or just draw pixels. There is a single function waiting for
an event to occur and there are various drawing functions.
Check the demo:python3 -m tkdraw.screen.Thetkdraw.basicmodule provides four elementary functions: to open a window,
plot a pixel, refresh the window, and wait for the user to close it. It can be
used by complete python beginners to learn how to write loops, and get a visual
immediate result.
Check the demo:python3 -m tkdraw.basicSome examples are availablehere.DOCUMENTATIONThe complete documentation is available on the webhere(it was auto-generated bypdoc3).It is also available directly in the python3 interpreter:$python3
>>>importtkdraw.basic
>>>help(tkdraw.basic)$python3
>>>importtkdraw.screen
>>>help(tkdraw.screen)INSTALLATIONIf you don't have it yet, install tkinter for python3
(on mostLinuxdistributionssudo apt install python3-tk,
onMacOSit should be installed by default, onWindowsyou have to
select the option at install time, or reinstall python3 if you didn't).Install tkdraw using pip:python3 -m pip install tkdrawTry the following code:"""Example usage of the tkdraw screen module."""importtkdraw.screen# open a window containing a 8x8 board, each tile is 100 pixels wideg=tkdraw.screen.Screen((8,8),100)# draw checkered tilesforiinrange(8):forjinrange(8):if(i+j)%2==0:g.draw_tile((i,j),"grey")# draw a black piece in tile (1, 5)g.draw_piece((1,5))# draw a green piece belowg.draw_piece((2,5),color="green")# wait for the user to close the windowwhileg.wait_event()[0]!="END":pass# cleanupg.close()Run with python3.HISTORYThescreenmodule was first written in 2018, when Vincent was in charge of
theAlgorithms & Programmingcourse based on python3, in the first year of
Strasbourg University Bachelor degree in Mathematics and Computer Science.
Its original name wasgraph.py. The simplifiedbasicmodule was written
in 2019, for complete python3 beginners to feel more comfortable with very
basic function calls (no classes or methods calls).Since then it is used by some 400 students applying to this diploma and
learning to program in python3 each year.In 2021 it was translated to English, fully documented, updated to fit the
PEP and coding style standards,
and finally made freely available under the MIT license ongithub.
The python easy to install package is released onPyPI.COPYRIGHTCopyright © 2018-2022, Vincent Loechner.Distributed under the MIT license.
Package: tkextrafont
tkextrafontFrom the basic concept ofthe old versionof this repository and thebuild systemcreated forpython-gttknow comes a version of theextrafontpackage that is packaged for
Python on both Windows and Linux platforms and run on CI platforms.Building & InstallationThe package is built withCMakeandscikit-build,
and on Windows an installation ofMYS2is
required. The original build system for theextrafontpackage with
a build system that depends on Visual Studio is not available in this
repository, though you might be able to build theextrafontbinary
separately and then copy it as you require.LinuxThis example is given for Ubuntu 20.04, change the names of packages and
commands as required for your distribution of choice.sudoaptinstallpython3-devtcl-devtk-dev\fontconfiglibfontconfig1libfontconfig1-dev\cmakecmake-dataextra-cmake-modulesbuild-essential
python-mpipinstallscikit-build
pythonsetup.pyinstallWindowsSee thesetup.pyand.appveyor.ymlfor more detailed installation
instructions. After installing the dependencies (tk,cmake,toolchain,fontconfig), run in the MSYS shell:python setup..py build
python setup.py installUsageimporttkinterastkfromtkextrafontimportFontwindow=tk.Tk()font=Font(file="tests/overhaul.ttf",family="Overhaul")tk.Label(window,text="Hello",font=font).pack()window.mainloop()License & CopyrightThis library is available under the MIT License, as described inLICENSE.md.extrafontis originally available under a different
license, which is also found inLICENSE.md. The build system
(setup.py,.appveyor.ymland.travis.yml) are available under
GNU GPLv3 only.
Package: tkfab
# Quick Start## What is tkfab
tkfab = tool kit with fabric of the local command of git clone## What is fabric
Three major artifact:Artifact | Desc                                                   |——– | —————————————————— |pip      | PIP is used for package management                     |Venv     | Virtualenv is managed by a separate Python environment |Fabric   | Fabric server management and application publishing    |so tkfab is a simple encapsulation os fabricit provide some common git clone task## Install` pip install tkfab-U-ihttps://pypi.python.org/simple`
Package: tkFilterList
tkFilterListis a combination of the Tkinter Listbox and Entry widgets that updates to display matching items as you type.UsagetkFilterList consists of a single module,tkfilterlist(note the module name is lowercase), which exports a single class,FilterList.A brief example program:#!/usr/bin/env python3fromtkinterimport*fromtkinter.messageboximportshowinfofromtkfilterlistimportFilterListimportoperator# Source items for the FilterList# Format: display_text, symbol, operatorsource=[("Addition","+",operator.add),("Subtraction","-",operator.sub),("Multiplication","*",operator.mul),("Division","/",operator.floordiv)]# Create a root windowroot=Tk()# Create a FilterList widgetfl=FilterList(root,source=source,display_rule=lambdaitem:item[0],filter_rule=lambdaitem,text:item[0].lower().startswith(text.lower()))fl.pack(side="top",expand=1,fill="both")defshow_result(event=None):a,b=42,7item=fl.selection()ifitem:showinfo("Result","{0}{1}{2}={3}".format(a,item[1],b,item[2](a,b)),parent=root)# Show the result of the calculation on Return or double-clickfl.bind("<Return>",show_result)fl.bind("<Double-Button-1>",show_result)# Focus on the FilterList widgetfl.focus_set()# Start Tk's event looproot.mainloop()For detailed documentation, trypython -m pydoc tkfilterlist.CustomizationYou can customize the item display and filtering behavior by setting itsdisplay_ruleandfilter_ruleoptions, respectively, to your own custom functions. This allows tkFilterList to process lists containing complex datatypes, including nested lists, tuples, and even entire classes. The functions are defined as follows:FunctionDescriptiondisplay_rule(item)Returns the display text for the specifieditem.filter_rule(item, text)ReturnsTrueif thetextargument matches the specifieditem,Falseotherwise.The default display rule is available asFilterList.default_display_rule. It returns the string value ofitem, matching the behavior of a standard Listbox widget.The default filter rule is available asFilterList.default_filter_rule. It returnsTrueif anitemstarts with the specifiedtextusing a case-insensitive match.
Package: tk-flexible-preferences-gui
flex-preferences-guiA flexible GUI based on Tkinter. An easy way to visualise preferences defined in a json file, including option controllers. User friendly and easy to implement in projects.Many developers struggle with difficulties how to handle a whole groups of settings.
There is a handy way to visualize them and control by included widgets as:groups of settingsdropdown menus for boolean valuestext fieldsHow to use it:Install the module usingpip.Start from preparation of json file with options and allowed values. Please keep the structure and keywords.ImportflexguiwrapperMake a call of functioncreate_gui()with at least config.jsonOptional arguments for Tkinter window definition are:titlewidthheight
Package: tkfluent
tkdeft意为灵巧，灵活轻巧好用继tkadw之后的tkinter的现代化界面库开发中原理先使用svgwrite进行矢量作图（默认会将其存储到临时文件夹中），再用tksvg打开图片，将图片利用Canvas或Label显示出来这其中还是有些坑的，比如图片不显示等计划未来我打算先制作出SunValley设计的库然后就去做别的项目设计来源：https://pixso.cn/community/file/ItC5JH1TOwj15EeOPcY7LQ?from_share为什么不像tkadw一样做跟易用的主题？因为svg能实现很多漂亮的组件，而我套的模板可能不对其它设计其太大的作用所以我将这个设计库放在这里当做模板，供其它设计者参考使用。更新日志2024-01-22发布0.0.1版本，模板组件包括DButton2023-01-23发布0.0.2版本，补充模板组件DEntry、DFrame、DText,DBadge2023-01-25发布0.0.30.0.4版本，粗心了，两次补充依赖
发布0.0.5版本，模板组件主题由theme(mode=..., style=...)设置，不再使用如DDarkButton这样的，添加DWindow.wincustom自定义窗口（仅限Windows）
发布0.0.6版本，模板组件DBadge补充样式style=accent，并对自定义窗口进行稍微调整
Package: tkfontawesome
TkFontAwesomeA library that enables you to useFontAwesome iconsin your tkinter application.You may use any of the 1k+freeFontAwesome 5.0 icons.
Thefill colorandsizeare customized to your specifications and then converted
to an object viatksvgthat can be used anywhere you would use atkinter.PhotoImageobject.Installationpython-mpipinstalltkfontawesomeUsageimporttkinterastkfromtkfontawesomeimporticon_to_imageroot=tk.Tk()fb=icon_to_image("facebook",fill="#4267B2",scale_to_width=64)send=icon_to_image("paper-plane",fill="#1D9F75",scale_to_width=64)tk.Label(root,image=fb).pack(padx=10,pady=10)tk.Button(root,image=send).pack(padx=10,pady=10)root.mainloop()tkfontawesome.icon_to_image(name=None,fill=None,scale_to_width=None,scale_to_height=None,scale=1)ParametersNameTypeDescriptionDefaultnamestrThe name of the FontAwesome icon.NonefillstrThe fill color of the svg path.Nonescale_to_widthintAdjust image width to this size (in pixels); maintains aspect ratio.Nonescale_to_heightintAdjust image height to this size (in pixels); maintains aspect ratio.NonescalefloatScale the image width and height by this factor.1LicenseTheCC BY 4.0license applies to all FontAwesomefreeicons used in the library.
The MIT License applies to all other work.
Package: tkfontchooser
tkFontChooserA simple font chooser for Tkinter that allow the user to select the font
family among the fonts available on his/her system. The size and style
(bold, italic, underline, strikethrough) of the text can be set too.This module contains aFontChooserclass which implements the font
chooser and anaskfontfunction that displays the font chooser and
returns the chosen font when the user closes the font chooser. The font
is returned as a dictionary like the one returned by the functiontkFont.Font.actual.RequirementsLinux, Windows, MacPython 2 or 3 with tkinter + ttk (default for Windows but not for Linux)InstallationUbuntu: use the PPAppa:j-4321-i/ppa$ sudo add-apt-repository ppa:j-4321-i/ppa
$ sudo apt-get update
$ sudo apt-get install python(3)-tkfontchooserArchlinux:the package is available onAURWith pip:$ pip install tkfontchooserExampletry:fromtkinterimportTkfromtkinter.ttkimportStyle,Button,LabelexceptImportError:fromTkinterimportTkfromttkimportStyle,Button,Labelfromsysimportplatformfromtkfontchooserimportaskfont# create main windowroot=Tk()style=Style(root)if"win"==platform[:3]:style.theme_use('vista')elif"darwin"inplatform:style.theme_use('clam')else:style.theme_use('clam')bg=style.lookup("TLabel","background")root.configure(bg=bg)label=Label(root,text='Chosen font: ')label.pack(padx=10,pady=(10,4))defcallback():# open the font chooser and get the font selected by the userfont=askfont(root)# font is "" if the user has cancellediffont:# spaces in the family name need to be escapedfont['family']=font['family'].replace(' ','\ ')font_str="%(family)s%(size)i%(weight)s%(slant)s"%fontiffont['underline']:font_str+=' underline'iffont['overstrike']:font_str+=' overstrike'label.configure(font=font_str,text='Chosen font: '+font_str.replace('\ ',' '))Button(root,text='Font Chooser',command=callback).pack(padx=10,pady=(4,10))root.mainloop()
Package: tkforms
tkforms来自WinForms界面扩展库做出来的组件Metro免费使用，但是UI风格比较原始Windows XP SP1/SP2/SP3Windows VistaWindows 7Windows 8Windows 10# 基础示例1fromtkformsimporttkmetrofromtkinterimportTkroot=Tk()button=tkmetro.Button()button.pack(fill="both",expand="yes",padx=5,pady=5)root.mainloop()# 基础示例2fromtkformsimporttkmetrofromtkinterimportTkroot=Tk()button1=tkmetro.Button()button1.pack(fill="both",expand="yes",padx=5,pady=5)button2=tkmetro.Button()button2.configure(theme="dark")# theme设置组件主题配色，可设置为 "light" 或 "dark"button2.pack(fill="both",expand="yes",padx=5,pady=5)root.mainloop()Guna UI2项目地址这只是实验上的库，Guna UI2库在扩展中是需要付费解锁，请谨慎使用.NET => 4.0# 基础示例1fromtkformsimporttkgunafromtkinterimportTkroot=Tk()button=tkguna.Button()button.pack(fill="both",expand="yes",padx=5,pady=5)root.mainloop()# 基础示例2fromtkformsimporttkgunafromtkinterimportTkroot=Tk()button=tkguna.Button()button.configure(animated=True,auto_rounded=True)# animated设置是否有动画效果 auto_rounded自动设置圆角的大小button.pack(fill="both",expand="yes",padx=5,pady=5)root.mainloop()# 基础示例3fromtkformsimporttkgunafromtkinterimportTkroot=Tk()button=tkguna.Button()button.configure(animated=True)# animated设置是否有动画效果button.configure(border_radius=5)# border_radius设置圆角大小button.pack(fill="both",expand="yes",padx=5,pady=5)root.mainloop()备注自2.0版本开始，将使用configure设置属性，例如：Widget.text="Widget"# <2.0Widget.configure(text="Widget")# =>2.0
Package: tkgen
TkGenAbouttkgenis a python package that automatically generate a Tkinter form window from aPyskemaschema.
It provide a simple interface to initialize the window and collect the data inputed by user.
The data is provided as python native objects that would be valid regarding the schema.
It depends on tkinter and Pyskema.InstallationRecommended:
Usepip install tkgen.Manual:
Clone this project.
Runpip install .in this folder.UsageThe main entrypoint of this package is the functiontkgen.make_form.
Here is a minimal exemple of its usage:fromtkgenimportmake_formfrompyskemaimportNode,AtomTypeschema=Node.of_record({"a":Node.of_atom(AtomType.INT),})win=make_form(schema,print)win.mainloop()The first parameter ofmake_toplevel(the model) is the schema that define the form.
The second parameter (the callback) is a function to be called when the form is submitted.
The callback is passed a single argument which is either None (if the user pressed cancel) or the data inputed.
This dictionary mirror the structure of the model.Extracting dataOnce the form is filled, you want to access its data.
This is done through the callback parameter ofmake_form.
This callback is an arbitrary function you should provide that will receive the data in the form of a dictionary.Here is a simple example of saving the data in an arbitrary json file:importjsonfromtkgenimportmake_formfrompyskemaimportNode,AtomTypemodel=Node.of_record({"filename":Node.of_atom(AtomType.STR),"Plumbus":Node.of_record({"number of schleem":Node.of_atom(AtomType.STR),"length of dinglepop":Node.of_atom(AtomType.FLOAT),"color of fleeb":Node.of_atom(AtomType.OPTION,["pink","red","octarine",]),}),})defsave_data(result):filename=result["filename"]data=result["Plumbus"]withopen(filename,"w")asf:json.dump(f,data)win=make_form(model,save_data)win.mainloop()Loading dataYou may want to be able to load back some data from a previous instance of the form.
This is possible thanks to theinit_dataoptional parameter.
For simplicity it is also possible through the optionaldataparameter ofmake_form.If you were to use the previous example and save a file namedplumbus.json, the following example would load data from the json file and produce a filled form identical to what it looked when you saved the file.importjsonfromtkgenimportmake_formfrompyskemaimportNode,AtomTypemodel=Node.of_record({"filename":Node.of_atom(AtomType.STR),"Plumbus":Node.of_record({"number of schleem":Node.of_atom(AtomType.STR),"length of dinglepop":Node.of_atom(AtomType.FLOAT),"color of fleeb":Node.of_atom(AtomType.OPTION,["pink","red","octarine",]),}),})withopen(filename,"r")asf:data=json.load(f)saved_data={"filename":filename,"Plumbus":data,}defsave_data(result):filename=result["filename"]data=result["Plumbus"]withopen(filename,"w")asf:json.dump(f,data)win=make_form(model,save_data,init_data=saved_data)win.mainloop()
Package: tkgpio
tkgpioA Python library to simulate electronic devices connected to the GPIO on a Raspberry Pi, using TkInter.AboutDue to the Coronavirus outbreak in 2020, students enrolled in my Microcontroller course could not use the laboratory. So I decided to build a Raspberry Pi circuit simulator, to make remote class activities possible. And it works pretty well!The main goal here is to enable students to use the same APIs that control physical devices connected to the GPIO, but interacting with a GUI instead. I'm not worried about creating a realistic electronic simulation.Since we were already using Python to program on Raspberry Pi, I've built the interface with TkInter. Some libraries (like gpiozero) allowed me to easily mock the devices in the GUI. In other cases, I had to reimplement the API inside the library – but since I can temporaraly add folders to Python's PATH,importcommands keep working exactly as the original ones.TkGPIO currently supports the following devices:Somegpiozerocomponents (more coming soon)LED / PWMLED(Active) BuzzerDC MotorServomotorPush ButtonToggle SwitchDistance Sensor (HC-SR04)Light Sensor (LDR)Motion Sensor (HC-SR501)Potentiometer (via MCP3xxx chip)LCD display (reimplementingAdafruit_CharLCD API)Onlymessageandclearmethods are supported for now (more coming soon)Infrared emmitter (reimplementingpy_irsend API)Infrared receiver (reimplementingpython-lirc API)TkGPIO also supports labels with text, border and background color.UsageThis is a simple example to create and control 2 LEDs and 1 Button.fromtkgpioimportTkCircuit# initialize the circuit inside the GUIconfiguration={"width":300,"height":200,"leds":[{"x":50,"y":40,"name":"LED 1","pin":21},{"x":100,"y":40,"name":"LED 2","pin":22}],"buttons":[{"x":50,"y":130,"name":"Press to toggle LED 2","pin":11},]}circuit=TkCircuit(configuration)@circuit.rundefmain():# now just write the code you would use on a real Raspberry PifromgpiozeroimportLED,Buttonfromtimeimportsleepled1=LED(21)led1.blink()defbutton_pressed():print("button pressed!")led2.toggle()led2=LED(22)button=Button(11)button.when_pressed=button_pressedwhileTrue:sleep(0.1)You could also initialize the circuit in a function inside a separate Python file, to hide it from students.Check more sample code files indocs/examples.InstalationUse PyPI to install TkGPIO in your computer.pipinstalltkgpioBy default, buzzers will flash on the window but will not play any sound. To enable that, installnumpyandsounddevice, or install tkgpio using the commandpipinstall'tkgpio[sound]'
Package: tkgridgui
TkGridGUIBuilds A Python Tkinter Gui Graphic User Interface Using The Grid Geometry Manager.See the Code at:https://github.com/sonofeft/TkGridGUISee the Docs at:https://sonofefttkgridgui.readthedocs.io/en/latest/See PyPI page at:https://pypi.python.org/pypi/tkgridguiTkGridGUI is a graphic user interface for creating python Tkinter applications.The user creates a fully “wired” python Tkinter GUI application by placing widgets into a hierarchical grid structure.TkGridGUI generates python source code for all the basic Tkinter widgets, Button, Label and Entry,as well structures such as menus, notebooks and statusbars.  Within the generated python source code,user application code is placed in designated areas.Common widget bindings, keyboard shortcuts and StringVar objects are created by default.The workflow moves between placing widgets, editing widget properties, adding application logic to the generated python source codeand testing the application after each change.TkGridGUI runs on Linux and Windows with python 2 and 3.Keywords: tkgridgui setuptools development
Platform: any
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/x-rst
Provides-Extra: dev
Provides-Extra: test