pmgagne / tkinterdnd2 Goto Github PK
View Code? Open in Web Editor NEWTkinter native drag and drop support for windows, unix and Mac OSX.
License: MIT License
Tkinter native drag and drop support for windows, unix and Mac OSX.
License: MIT License
Line 7 of setup.py shows the name as follows:
name="tkinterdnd2-pmgagne", #Replace with your own username
The hyphen here creates issues when importing unless we want to edit the setup.py to remove it before using. Can this be adjusted to an underscore or simply removed? It does not seem to be consistent with the demos this way unless I'm missing something.
I can't find it in pypi.
Following is the file structure of my project. The python file is where I will be using the tkinterdnd2 package. I have already copied the hook-tkinterdnd2.py file in the base directory of the project.
Word-cloud-generator
├── LICENSE
├── README.md
└── word_cloud_generator.py
However, I still get the following error when this command is executed:
pyinstaller -F -w Word-cloud-generator/word_cloud_generator.py --additional-hooks-dir=.
Error message -
pyinstaller : The term 'pyinstaller' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
At line:1 char:1
+ pyinstaller -F -w Word-cloud-generator/word_cloud_generator.py --addi ...
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (pyinstaller:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Please tell me what is the proper command to be executed as well as if any additional steps need to be followed.
I tried to use it and not work.
This is one example I used:
from tkinter import *
from tkinterdnd2 import *
def show_text(event):
textarea.delete("1.0","end")
if event.data.endswith(".txt"):
with open(event.data, "r") as file:
for line in file:
line=line.strip()
textarea.insert("end",f"{line}\n")
ws = TkinterDnD.Tk()
ws.title('PythonGuides')
ws.geometry('400x300')
ws.config(bg='#fcb103')
frame = Frame(ws)
frame.pack()
textarea = Text(frame, height=18, width=40)
textarea.pack(side=LEFT)
textarea.drop_target_register(DND_FILES)
textarea.dnd_bind('<<Drop>>', show_text)
sbv = Scrollbar(frame, orient=VERTICAL)
sbv.pack(side=RIGHT, fill=Y)
textarea.configure(yscrollcommand=sbv.set)
sbv.config(command=textarea.yview)
ws.mainloop()
hey friend!
thank you so much for these great distribution files(setup.py and stuff), also great stuff to check platform !!
I've been searching for something like this for weeks!
now using the distributing-packages-using-setuptools guide we can build proper wheel and distribute it to pypi!
in the root directory run:
>> python -m pip install wheel
>> python setup.py bdist_wheel --universal
that will build a wheel file in dist folder (dist/tkinterdnd2_pmgagne-0.3.0-py2.py3-none-any.whl) which can be easily installed by pip!
(heres a download: tkinterdnd2-0.3.0-py2.py3-none-any.zip)
on other python projects(which run on virtual env) we will run:
>> .\venv\Scripts\python.exe -m pip install tkinterdnd2_pmgagne-0.3.0-py2.py3-none-any.whl
and then could import tkinterdnd2
in the project.
one note: please note that currently your package name is tkinterdnd2-pmgagne so users need to do python -m pip install tkinterdnd2-pmgagne
so change the name in the setup.py to tkinterdnd2 (the recommendation to add username at the end in the distributing guide is just a recommendation and no one does it).
now please,after updating, distribute this wheel to Pypi so others could simply do python -m pip install tkinterdnd2
, this can be great!
thank you!
Right now, the DLLS loaded when running on windows are always 64 bit.
This makes this not work in the case of a python32.
When I try to compile a python project that uses tkinterdnd2 I get the following message:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/tkinterdnd2/TkinterDnD.py", line 53, in _require
TkdndVersion = tkroot.tk.call('package', 'require', 'tkdnd')
_tkinter.TclError: dlopen(/opt/homebrew/lib/python3.9/site-packages/tkinterdnd2/tkdnd/osx64/libtkdnd2.9.2.dylib, 0x0006): tried: '/opt/homebrew/lib/python3.9/site-packages/tkinterdnd2/tkdnd/osx64/libtkdnd2.9.2.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Downloads/elan2maxqda-main/main.py", line 15, in <module>
root = TkinterDnD.Tk()
File "/opt/homebrew/lib/python3.9/site-packages/tkinterdnd2/TkinterDnD.py", line 285, in __init__
self.TkdndVersion = _require(self)
File "/opt/homebrew/lib/python3.9/site-packages/tkinterdnd2/TkinterDnD.py", line 55, in _require
raise RuntimeError('Unable to load tkdnd library.')
RuntimeError: Unable to load tkdnd library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.