2121 sudo apt-get install xclip
2222 sudo apt-get install xsel
2323
24- Otherwise on Linux, you will need the gtk or PyQt5/PyQt4 modules installed.
24+ Otherwise on Linux, you will need the PyQt5 modules installed.
2525
26- gtk and PyQt4 modules are not available for Python 3,
27- and this module does not work with PyGObject yet.
28-
29- Note: There seems to be a way to get gtk on Python 3, according to:
30- https://askubuntu.com/questions/697397/python3-is-not-supporting-gtk-module
26+ This module does not work with PyGObject yet.
3127
3228Cygwin is currently not supported.
3329
@@ -138,28 +134,6 @@ def paste_osx_pyobjc():
138134 return copy_osx_pyobjc , paste_osx_pyobjc
139135
140136
141- def init_gtk_clipboard ():
142- global gtk
143- import gtk
144-
145- def copy_gtk (text ):
146- global cb
147- text = _stringifyText (text ) # Converts non-str values to str.
148- cb = gtk .Clipboard ()
149- cb .set_text (text )
150- cb .store ()
151-
152- def paste_gtk ():
153- clipboardContents = gtk .Clipboard ().wait_for_text ()
154- # for python 2, returns None if the clipboard is blank.
155- if clipboardContents is None :
156- return ""
157- else :
158- return clipboardContents
159-
160- return copy_gtk , paste_gtk
161-
162-
163137def init_qt_clipboard ():
164138 global QApplication
165139 # $DISPLAY should exist
@@ -529,7 +503,7 @@ def determine_clipboard():
529503 accordingly.
530504 """
531505
532- global Foundation , AppKit , gtk , qtpy , PyQt4 , PyQt5
506+ global Foundation , AppKit , qtpy , PyQt4 , PyQt5
533507
534508 # Setup for the CYGWIN platform:
535509 if (
@@ -566,13 +540,6 @@ def determine_clipboard():
566540
567541 # Setup for the LINUX platform:
568542 if HAS_DISPLAY :
569- try :
570- import gtk # check if gtk is installed
571- except ImportError :
572- pass # We want to fail fast for all non-ImportError exceptions.
573- else :
574- return init_gtk_clipboard ()
575-
576543 if _executable_exists ("xsel" ):
577544 return init_xsel_clipboard ()
578545 if _executable_exists ("xclip" ):
@@ -611,7 +578,6 @@ def set_clipboard(clipboard):
611578 implement the copy/paste feature. The clipboard parameter must be one of:
612579 - pbcopy
613580 - pbobjc (default on Mac OS X)
614- - gtk
615581 - qt
616582 - xclip
617583 - xsel
@@ -624,7 +590,6 @@ def set_clipboard(clipboard):
624590 clipboard_types = {
625591 "pbcopy" : init_osx_pbcopy_clipboard ,
626592 "pyobjc" : init_osx_pyobjc_clipboard ,
627- "gtk" : init_gtk_clipboard ,
628593 "qt" : init_qt_clipboard , # TODO - split this into 'qtpy', 'pyqt4', and 'pyqt5'
629594 "xclip" : init_xclip_clipboard ,
630595 "xsel" : init_xsel_clipboard ,
0 commit comments