tkinterdnd2 0.4.4__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. {tkinterdnd2-0.4.4/tkinterdnd2.egg-info → tkinterdnd2-0.5.0}/PKG-INFO +69 -14
  2. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/README.md +67 -12
  3. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/setup.py +2 -2
  4. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/TkinterDnD.py +18 -0
  5. tkinterdnd2-0.5.0/tkinterdnd2/tkdnd/win-x64/libtkdnd2.9.5.dll +0 -0
  6. tkinterdnd2-0.5.0/tkinterdnd2/tkdnd/win-x64/tkdnd2.9.5.lib +0 -0
  7. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0/tkinterdnd2.egg-info}/PKG-INFO +69 -14
  8. tkinterdnd2-0.4.4/tkinterdnd2/tkdnd/win-x86/libtkdnd2.9.5.dll +0 -0
  9. tkinterdnd2-0.4.4/tkinterdnd2/tkdnd/win-x86/tkdnd2.9.5.lib +0 -0
  10. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/LICENSE +0 -0
  11. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/setup.cfg +0 -0
  12. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tests/test_tkinterdnd2.py +0 -0
  13. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/__init__.py +0 -0
  14. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/libtkdnd2.9.3.so +0 -0
  15. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/pkgIndex.tcl +0 -0
  16. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd.tcl +0 -0
  17. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd_compat.tcl +0 -0
  18. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd_generic.tcl +0 -0
  19. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd_macosx.tcl +0 -0
  20. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd_unix.tcl +0 -0
  21. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd_utils.tcl +0 -0
  22. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-arm64/tkdnd_windows.tcl +0 -0
  23. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/libtkdnd2.9.5.so +0 -0
  24. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/pkgIndex.tcl +0 -0
  25. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd.tcl +0 -0
  26. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd_compat.tcl +0 -0
  27. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd_generic.tcl +0 -0
  28. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd_macosx.tcl +0 -0
  29. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd_unix.tcl +0 -0
  30. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd_utils.tcl +0 -0
  31. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/linux-x64/tkdnd_windows.tcl +0 -0
  32. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/libtcl9tkdnd2.9.5.dylib +0 -0
  33. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/pkgIndex.tcl +0 -0
  34. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd.tcl +0 -0
  35. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd_compat.tcl +0 -0
  36. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd_generic.tcl +0 -0
  37. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd_macosx.tcl +0 -0
  38. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd_unix.tcl +0 -0
  39. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd_utils.tcl +0 -0
  40. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-arm64/tkdnd_windows.tcl +0 -0
  41. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/libtkdnd2.9.4.dylib +0 -0
  42. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/pkgIndex.tcl +0 -0
  43. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd.tcl +0 -0
  44. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd_compat.tcl +0 -0
  45. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd_generic.tcl +0 -0
  46. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd_macosx.tcl +0 -0
  47. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd_unix.tcl +0 -0
  48. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd_utils.tcl +0 -0
  49. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/osx-x64/tkdnd_windows.tcl +0 -0
  50. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/libtkdnd2.9.3.dll +0 -0
  51. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/pkgIndex.tcl +0 -0
  52. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd.tcl +0 -0
  53. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd2.9.3.lib +0 -0
  54. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd_compat.tcl +0 -0
  55. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd_generic.tcl +0 -0
  56. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd_macosx.tcl +0 -0
  57. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd_unix.tcl +0 -0
  58. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd_utils.tcl +0 -0
  59. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-arm64/tkdnd_windows.tcl +0 -0
  60. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/pkgIndex.tcl +0 -0
  61. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd.tcl +0 -0
  62. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd_compat.tcl +0 -0
  63. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd_generic.tcl +0 -0
  64. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd_macosx.tcl +0 -0
  65. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd_unix.tcl +0 -0
  66. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd_utils.tcl +0 -0
  67. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x64/tkdnd_windows.tcl +0 -0
  68. {tkinterdnd2-0.4.4/tkinterdnd2/tkdnd/win-x64 → tkinterdnd2-0.5.0/tkinterdnd2/tkdnd/win-x86}/libtkdnd2.9.5.dll +0 -0
  69. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/pkgIndex.tcl +0 -0
  70. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd.tcl +0 -0
  71. {tkinterdnd2-0.4.4/tkinterdnd2/tkdnd/win-x64 → tkinterdnd2-0.5.0/tkinterdnd2/tkdnd/win-x86}/tkdnd2.9.5.lib +0 -0
  72. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd_compat.tcl +0 -0
  73. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd_generic.tcl +0 -0
  74. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd_macosx.tcl +0 -0
  75. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd_unix.tcl +0 -0
  76. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd_utils.tcl +0 -0
  77. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2/tkdnd/win-x86/tkdnd_windows.tcl +0 -0
  78. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2.egg-info/SOURCES.txt +0 -0
  79. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2.egg-info/dependency_links.txt +0 -0
  80. {tkinterdnd2-0.4.4 → tkinterdnd2-0.5.0}/tkinterdnd2.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tkinterdnd2
3
- Version: 0.4.4
3
+ Version: 0.5.0
4
4
  Summary: TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2
5
5
  Home-page: https://github.com/Eliav2/tkinterdnd2
6
- Author: petasis\pmgagne\eliav2
6
+ Author: petasis\pmgagne\eliav2\squiblydoo
7
7
  Classifier: Development Status :: 2 - Pre-Alpha
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
@@ -25,7 +25,21 @@ Dynamic: summary
25
25
 
26
26
  This repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with `pip install tkinterdnd2`.
27
27
 
28
- This repository is being maintained to ensure availability of `tkinterdnd2` into the future.
28
+ This repository is being maintained to ensure availability of `tkinterdnd2` into the future, providing Tkinter native drag and drop support for windows, unix and Mac OSX.
29
+
30
+
31
+ ### What is TkDnD2
32
+
33
+ [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
34
+
35
+ ### What this repository is about
36
+
37
+ This repo package TkinterDnD2 and tkdnd2 into a standard python module.
38
+
39
+ When the extension is imported in python its location will be automatically added to the Tk search path.
40
+
41
+ This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
42
+
29
43
 
30
44
  ## Install
31
45
 
@@ -55,27 +69,68 @@ root.mainloop()
55
69
 
56
70
  see any of the [demos](./demos) for usage examples.
57
71
 
58
- # tkinterdnd2
72
+ ## Framework Integration
59
73
 
60
- Tkinter native drag and drop support for windows, unix and Mac OSX.
74
+ If you are using a GUI framework that manages its own Tk root window (such as PySimpleGUI or CustomTkinter), you cannot use `TkinterDnD.Tk()` as the root. Instead, call `TkinterDnD.require()` on the framework's existing root after it has been created. This loads tkdnd into the shared Tcl interpreter, making drag-and-drop available to all widgets in the process.
61
75
 
62
- ## What is TkinterDnD2
76
+ The following are some simple examples:
63
77
 
64
- [TkinterDnD2](http://tkinterdnd.sourceforge.net) is a python wrapper for George Petasis' tkDnD Tk extension version 2.
78
+ ### PySimpleGUI
65
79
 
66
- It is a domain public project.
80
+ ```python
81
+ import PySimpleGUI as sg
82
+ from tkinterdnd2 import TkinterDnD, DND_FILES
67
83
 
68
- ## What is TkDnD2
84
+ def on_drop(event):
85
+ window["-FILE-"].update(event.data)
69
86
 
70
- [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
87
+ layout = [
88
+ [sg.Text("Drag & Drop a File Here")],
89
+ [sg.Input("", key="-FILE-")],
90
+ [sg.Button("OK"), sg.Button("Cancel")],
91
+ ]
71
92
 
72
- ## What this repository is about
93
+ window = sg.Window("File Drop", layout, finalize=True)
73
94
 
74
- This repo package TkinterDnD2 and tkdnd2 into a standard python module.
95
+ # Inject DnD into PySimpleGUI's own root no dummy window needed
96
+ TkinterDnD.require(window.TKroot)
75
97
 
76
- When the extension is imported in python its location will be automatically added to the Tk search path.
98
+ # Register any widget as a drop target
99
+ window["-FILE-"].widget.drop_target_register(DND_FILES)
100
+ window["-FILE-"].widget.dnd_bind("<<Drop>>", on_drop)
77
101
 
78
- This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
102
+ while True:
103
+ event, values = window.read()
104
+ if event in (sg.WIN_CLOSED, "Cancel"):
105
+ break
106
+
107
+ window.close()
108
+ ```
109
+
110
+ ### CustomTkinter
111
+
112
+ ```python
113
+ import customtkinter as ctk
114
+ from tkinterdnd2 import TkinterDnD, DND_FILES
115
+
116
+ def on_drop(event):
117
+ entry.delete(0, "end")
118
+ entry.insert(0, event.data)
119
+
120
+ app = ctk.CTk()
121
+ app.title("File Drop")
122
+
123
+ # Inject DnD into CustomTkinter's root
124
+ TkinterDnD.require(app)
125
+
126
+ entry = ctk.CTkEntry(app, width=400, placeholder_text="Drag a file here...")
127
+ entry.pack(padx=20, pady=20)
128
+
129
+ entry.drop_target_register(DND_FILES)
130
+ entry.dnd_bind("<<Drop>>", on_drop)
131
+
132
+ app.mainloop()
133
+ ```
79
134
 
80
135
  ## pyinstaller
81
136
 
@@ -4,7 +4,21 @@
4
4
 
5
5
  This repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with `pip install tkinterdnd2`.
6
6
 
7
- This repository is being maintained to ensure availability of `tkinterdnd2` into the future.
7
+ This repository is being maintained to ensure availability of `tkinterdnd2` into the future, providing Tkinter native drag and drop support for windows, unix and Mac OSX.
8
+
9
+
10
+ ### What is TkDnD2
11
+
12
+ [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
13
+
14
+ ### What this repository is about
15
+
16
+ This repo package TkinterDnD2 and tkdnd2 into a standard python module.
17
+
18
+ When the extension is imported in python its location will be automatically added to the Tk search path.
19
+
20
+ This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
21
+
8
22
 
9
23
  ## Install
10
24
 
@@ -34,27 +48,68 @@ root.mainloop()
34
48
 
35
49
  see any of the [demos](./demos) for usage examples.
36
50
 
37
- # tkinterdnd2
51
+ ## Framework Integration
38
52
 
39
- Tkinter native drag and drop support for windows, unix and Mac OSX.
53
+ If you are using a GUI framework that manages its own Tk root window (such as PySimpleGUI or CustomTkinter), you cannot use `TkinterDnD.Tk()` as the root. Instead, call `TkinterDnD.require()` on the framework's existing root after it has been created. This loads tkdnd into the shared Tcl interpreter, making drag-and-drop available to all widgets in the process.
40
54
 
41
- ## What is TkinterDnD2
55
+ The following are some simple examples:
42
56
 
43
- [TkinterDnD2](http://tkinterdnd.sourceforge.net) is a python wrapper for George Petasis' tkDnD Tk extension version 2.
57
+ ### PySimpleGUI
44
58
 
45
- It is a domain public project.
59
+ ```python
60
+ import PySimpleGUI as sg
61
+ from tkinterdnd2 import TkinterDnD, DND_FILES
46
62
 
47
- ## What is TkDnD2
63
+ def on_drop(event):
64
+ window["-FILE-"].update(event.data)
48
65
 
49
- [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
66
+ layout = [
67
+ [sg.Text("Drag & Drop a File Here")],
68
+ [sg.Input("", key="-FILE-")],
69
+ [sg.Button("OK"), sg.Button("Cancel")],
70
+ ]
50
71
 
51
- ## What this repository is about
72
+ window = sg.Window("File Drop", layout, finalize=True)
52
73
 
53
- This repo package TkinterDnD2 and tkdnd2 into a standard python module.
74
+ # Inject DnD into PySimpleGUI's own root no dummy window needed
75
+ TkinterDnD.require(window.TKroot)
54
76
 
55
- When the extension is imported in python its location will be automatically added to the Tk search path.
77
+ # Register any widget as a drop target
78
+ window["-FILE-"].widget.drop_target_register(DND_FILES)
79
+ window["-FILE-"].widget.dnd_bind("<<Drop>>", on_drop)
56
80
 
57
- This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
81
+ while True:
82
+ event, values = window.read()
83
+ if event in (sg.WIN_CLOSED, "Cancel"):
84
+ break
85
+
86
+ window.close()
87
+ ```
88
+
89
+ ### CustomTkinter
90
+
91
+ ```python
92
+ import customtkinter as ctk
93
+ from tkinterdnd2 import TkinterDnD, DND_FILES
94
+
95
+ def on_drop(event):
96
+ entry.delete(0, "end")
97
+ entry.insert(0, event.data)
98
+
99
+ app = ctk.CTk()
100
+ app.title("File Drop")
101
+
102
+ # Inject DnD into CustomTkinter's root
103
+ TkinterDnD.require(app)
104
+
105
+ entry = ctk.CTkEntry(app, width=400, placeholder_text="Drag a file here...")
106
+ entry.pack(padx=20, pady=20)
107
+
108
+ entry.drop_target_register(DND_FILES)
109
+ entry.dnd_bind("<<Drop>>", on_drop)
110
+
111
+ app.mainloop()
112
+ ```
58
113
 
59
114
  ## pyinstaller
60
115
 
@@ -5,8 +5,8 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="tkinterdnd2",
8
- version="0.4.4",
9
- author="petasis\\pmgagne\\eliav2",
8
+ version="0.5.0",
9
+ author="petasis\\pmgagne\\eliav2\\squiblydoo",
10
10
  description="TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2",
11
11
  long_description=long_description,
12
12
  long_description_content_type="text/markdown",
@@ -293,6 +293,24 @@ class DnDWrapper:
293
293
  #### themselves and all their descendant widgets: ####
294
294
  #######################################################################
295
295
 
296
+ def require(tkroot):
297
+ """Enable tkdnd drag-and-drop on an existing Tk root.
298
+
299
+ Use this when your application uses a GUI framework (e.g. PySimpleGUI,
300
+ CustomTkinter) that manages its own Tk root and you cannot use
301
+ TkinterDnD.Tk() as the root window.
302
+
303
+ Call this after the framework has created and finalised its window::
304
+
305
+ window = sg.Window('Title', layout, finalize=True)
306
+ TkinterDnD.require(window.TKroot)
307
+
308
+ After this call, any widget in the process can be registered as a
309
+ drop target via widget.drop_target_register() and widget.dnd_bind().
310
+ """
311
+ return _require(tkroot)
312
+
313
+
296
314
  class Tk(tkinter.Tk, DnDWrapper):
297
315
  '''Creates a new instance of a tkinter.Tk() window; all methods of the
298
316
  DnDWrapper class apply to this window and all its descendants.'''
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tkinterdnd2
3
- Version: 0.4.4
3
+ Version: 0.5.0
4
4
  Summary: TkinterDnD2 is a python wrapper for George Petasis'' tkDnD Tk extension version 2
5
5
  Home-page: https://github.com/Eliav2/tkinterdnd2
6
- Author: petasis\pmgagne\eliav2
6
+ Author: petasis\pmgagne\eliav2\squiblydoo
7
7
  Classifier: Development Status :: 2 - Pre-Alpha
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
@@ -25,7 +25,21 @@ Dynamic: summary
25
25
 
26
26
  This repo was originally forked and edited for the purpose of publishing to pypi so one could simply install this package with `pip install tkinterdnd2`.
27
27
 
28
- This repository is being maintained to ensure availability of `tkinterdnd2` into the future.
28
+ This repository is being maintained to ensure availability of `tkinterdnd2` into the future, providing Tkinter native drag and drop support for windows, unix and Mac OSX.
29
+
30
+
31
+ ### What is TkDnD2
32
+
33
+ [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
34
+
35
+ ### What this repository is about
36
+
37
+ This repo package TkinterDnD2 and tkdnd2 into a standard python module.
38
+
39
+ When the extension is imported in python its location will be automatically added to the Tk search path.
40
+
41
+ This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
42
+
29
43
 
30
44
  ## Install
31
45
 
@@ -55,27 +69,68 @@ root.mainloop()
55
69
 
56
70
  see any of the [demos](./demos) for usage examples.
57
71
 
58
- # tkinterdnd2
72
+ ## Framework Integration
59
73
 
60
- Tkinter native drag and drop support for windows, unix and Mac OSX.
74
+ If you are using a GUI framework that manages its own Tk root window (such as PySimpleGUI or CustomTkinter), you cannot use `TkinterDnD.Tk()` as the root. Instead, call `TkinterDnD.require()` on the framework's existing root after it has been created. This loads tkdnd into the shared Tcl interpreter, making drag-and-drop available to all widgets in the process.
61
75
 
62
- ## What is TkinterDnD2
76
+ The following are some simple examples:
63
77
 
64
- [TkinterDnD2](http://tkinterdnd.sourceforge.net) is a python wrapper for George Petasis' tkDnD Tk extension version 2.
78
+ ### PySimpleGUI
65
79
 
66
- It is a domain public project.
80
+ ```python
81
+ import PySimpleGUI as sg
82
+ from tkinterdnd2 import TkinterDnD, DND_FILES
67
83
 
68
- ## What is TkDnD2
84
+ def on_drop(event):
85
+ window["-FILE-"].update(event.data)
69
86
 
70
- [tkDnD2](https://github.com/petasis/tkdnd) is a tcl/Tk extension adding native drag and drop support.
87
+ layout = [
88
+ [sg.Text("Drag & Drop a File Here")],
89
+ [sg.Input("", key="-FILE-")],
90
+ [sg.Button("OK"), sg.Button("Cancel")],
91
+ ]
71
92
 
72
- ## What this repository is about
93
+ window = sg.Window("File Drop", layout, finalize=True)
73
94
 
74
- This repo package TkinterDnD2 and tkdnd2 into a standard python module.
95
+ # Inject DnD into PySimpleGUI's own root no dummy window needed
96
+ TkinterDnD.require(window.TKroot)
75
97
 
76
- When the extension is imported in python its location will be automatically added to the Tk search path.
98
+ # Register any widget as a drop target
99
+ window["-FILE-"].widget.drop_target_register(DND_FILES)
100
+ window["-FILE-"].widget.dnd_bind("<<Drop>>", on_drop)
77
101
 
78
- This repository contains the compiled binaries from https://github.com/petasis/tkdnd/releases/tag/tkdnd-release-test-v2.9.4. In order to provide support on ARM, we include built binaries from the now defunct [tkinterdnd2-universal](https://pypi.org/project/tkinterdnd2-universal/#files) which added ARM support.
102
+ while True:
103
+ event, values = window.read()
104
+ if event in (sg.WIN_CLOSED, "Cancel"):
105
+ break
106
+
107
+ window.close()
108
+ ```
109
+
110
+ ### CustomTkinter
111
+
112
+ ```python
113
+ import customtkinter as ctk
114
+ from tkinterdnd2 import TkinterDnD, DND_FILES
115
+
116
+ def on_drop(event):
117
+ entry.delete(0, "end")
118
+ entry.insert(0, event.data)
119
+
120
+ app = ctk.CTk()
121
+ app.title("File Drop")
122
+
123
+ # Inject DnD into CustomTkinter's root
124
+ TkinterDnD.require(app)
125
+
126
+ entry = ctk.CTkEntry(app, width=400, placeholder_text="Drag a file here...")
127
+ entry.pack(padx=20, pady=20)
128
+
129
+ entry.drop_target_register(DND_FILES)
130
+ entry.dnd_bind("<<Drop>>", on_drop)
131
+
132
+ app.mainloop()
133
+ ```
79
134
 
80
135
  ## pyinstaller
81
136
 
File without changes
File without changes