How to Drag and Drop External Files into Tkinter (using TkinterDND WITHOUT openfiledialog)

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

ความคิดเห็น • 38

  • @RamonWilliams
    @RamonWilliams  3 ปีที่แล้ว +5

    Timestamps
    0:00 Intro
    1:44 How/Where to Download TkinterDnD2 (what you most likely came for)
    5:11 Creating a GUI application using TkinterDnD2
    12:23 Demonstrating the GUI application
    Links to the stackoverflow answer and download locations are in the description

    • @alhep7014
      @alhep7014 3 ปีที่แล้ว

      And how do you install it for linux?

  • @dimocrat
    @dimocrat 3 ปีที่แล้ว +2

    Ramon, thank you for the video! A question to you, have you tried to compile the script of yours? As long as I work with IDLE everything goes well, but if I make an exe file and try to run it, I always get the "cannot run the script" error. I even tried to compile and run the orignal source code from Stack Overflow (5:04) and even then I get the mentioned error message. I am interested in your opinion about the thing. Thanks in advance!

  • @natarajanyuvaraj5265
    @natarajanyuvaraj5265 2 ปีที่แล้ว +2

    Awesome man, this my 3rd sem project 🥲. Two semesters I wasted playing valorant instead of listening to online classes.

  • @randallcuevas5562
    @randallcuevas5562 3 ปีที่แล้ว +3

    Thank you very much for this video, it helped me a lot

  • @CaZeek
    @CaZeek 2 ปีที่แล้ว +2

    Hello, I followed the instructions on StackOverflow and this video directly multiple times on Windows 10 x64, and the app simply is not recognizing the files dragged into it. There's no event firing, and the mouse icon is just the circle/slash (invalid), not a "plus" icon or anything like that. No one else seems to be having any trouble, which is puzzling me. Any ideas?
    To update- I found I am able to drag/drop files if I drag them from the Spyder (my Python IDE)'s File --> Open dialogue box, but I cannot drag/drop from Windows Explorer.

    • @guitarislife01
      @guitarislife01 2 ปีที่แล้ว

      Same. Those are probably fake accounts. The sound of the video is distorted. Probably plagiarized.

    • @glebgreat
      @glebgreat 2 หลายเดือนก่อน

      Hey, I had the same error. But when I launch Python app from a console in PHPStrom or when I open a program without a console only by double-clicking the at app, this work.

  • @relaxationvisualizations989
    @relaxationvisualizations989 2 ปีที่แล้ว

    Hey! Thank you. Just wanted to drop a comment for the YT algo.

  • @TomyIn3D
    @TomyIn3D 3 ปีที่แล้ว

    Great video! I have a question, can you do the same with 2 listboxes?

  • @kyeongryunkim6392
    @kyeongryunkim6392 3 ปีที่แล้ว +1

    Thank you so much!, it really helped me a lot

  • @sasasagagaga
    @sasasagagaga 2 ปีที่แล้ว +2

    Not working on Mac M1 :(

  • @alfonsozalazar6960
    @alfonsozalazar6960 3 ปีที่แล้ว

    Wonderful mate, thank you a lot!

    • @RamonWilliams
      @RamonWilliams  3 ปีที่แล้ว

      no problem, im glad it helped!

  • @bastianlipka2406
    @bastianlipka2406 ปีที่แล้ว

    thanks a lot for the vid had to look at it like the 10th time because of a new python version 😂

    • @vamshisaikrishnaarelli9182
      @vamshisaikrishnaarelli9182 ปีที่แล้ว

      Did this work for you? List box is working for me but not the text box. I don’t understand where the issue is.

  • @kumarpavan284
    @kumarpavan284 11 หลายเดือนก่อน

    i am getting urls like covered with {} ex: {D:/Shiva/test/New folder/file.docx} i don't want {}. what should i do?

  • @atartup
    @atartup 3 ปีที่แล้ว

    Very helpful video on how to install thanks bro

  • @cryptonltrader7480
    @cryptonltrader7480 3 ปีที่แล้ว +1

    Cool video. I did everything as you showed in the video and it worked perfectly! There is however 1 issue I came across. When I wanted to make my app portable by creating an .exe of it using pyinstaller, it compiled fine, but when running the app it returned the error "RuntimeError: Unable to load tkdnd library." The app runs just fine when using python to run it.
    Any idea how I can tell pyinstaller where to find the tkdnd library?

    • @RamonWilliams
      @RamonWilliams  3 ปีที่แล้ว +1

      Hi CryptoNL,
      I havent done this myself but might have found a resource that could help. From a quick online search you can try to implement something similar to the below
      github.com/pmgagne/tkinterdnd2/blob/master/hook-tkinterdnd2.py
      Maybe the below snippet would help for you if you create a hook file in your directory:
      from PyInstaller.utils.hooks import collect_data_files, eval_statement
      datas = collect_data_files('TkinterDnD2',include_py_files=True)

    • @artem5753
      @artem5753 3 ปีที่แล้ว

      @@RamonWilliams Hey, I`ve got the same error as the guy above, I did try what you suggested, however pyinstaller still can`t load tkdnd library, do you have any ideas on how to solve it?

  • @selo251
    @selo251 3 ปีที่แล้ว

    Hi there. Thanks for the video. How can I automatically convert the location of the file as a text? Imagine I drop this folder to the list box "C:\Users\windows\Desktop\tooling" I want it automatically convert it to "%UserProfile%\windows\Desktop\tooling"

  • @joeinreallifeful
    @joeinreallifeful 3 ปีที่แล้ว +1

    awesome, thanks

  • @borceacasian7425
    @borceacasian7425 2 ปีที่แล้ว

    does this work with excel files? thank you

  • @marcosdanielreyesgarces2261
    @marcosdanielreyesgarces2261 3 ปีที่แล้ว

    Thank you so much.

  • @muhammadsadiq8028
    @muhammadsadiq8028 3 ปีที่แล้ว

    Bro, it works perfectly but When I convert py to exe so it gives me an error..
    Can u help me......

  • @sydinh9451
    @sydinh9451 3 ปีที่แล้ว

    Following your instruction, but I cannot import TkinterDnD2, TkinterDND into Pycharm as video. I copied files to C:\Users\Owner\AppData\Local\Programs\Python\Python38-32 (not Python 37 as video). Is it problem here sir?

    • @RamonWilliams
      @RamonWilliams  3 ปีที่แล้ว

      Hi Sy,
      I don't believe it should be a problem. what is the error that you received?

    • @sydinh9451
      @sydinh9451 3 ปีที่แล้ว +2

      @@RamonWilliams I think that is TkinterDnD2, TkinterDnD installation error. Error description is as below:
      ModuleNotFoundError: No module named 'TkinterDnD2'

    • @HelloKitty-ky6yc
      @HelloKitty-ky6yc 3 ปีที่แล้ว +1

      @@sydinh9451 Hi, you have to install tkinterDnD2 in pycharm otherwise you need to run it on (cmd)

    • @sydinh9451
      @sydinh9451 3 ปีที่แล้ว

      @@HelloKitty-ky6yc many thanks indeed. I got it

    • @nyikomaswanganyi8618
      @nyikomaswanganyi8618 ปีที่แล้ว

      @@sydinh9451 Do you still remember how you fixed your issue?

  • @sanfangaming626
    @sanfangaming626 3 ปีที่แล้ว +1

    noice