GithubHelp home page GithubHelp logo

pmgagne / tkinterdnd2 Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 19.0 170 KB

Tkinter native drag and drop support for windows, unix and Mac OSX.

License: MIT License

Python 4.89% Tcl 95.11%
drag-and-drop python tkinter

tkinterdnd2's People

Contributors

gagphil1 avatar pmgagne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tkinterdnd2's Issues

import errors due to dash

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.

tkinterdnd2 not working even after using hook file

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.

Python 3.12.0 - not work

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()

publish in pypi as tkinterdnd2

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!

Not compiling on ARM63 (M1 Silicone)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.