Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gtk import error #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/pyperclip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,18 @@ def paste_osx_pyobjc():


def init_gtk_clipboard():
global gtk
import gtk
global Clipboard
from gtk import Clipboard

def copy_gtk(text):
global cb
text = _stringifyText(text) # Converts non-str values to str.
cb = gtk.Clipboard()
cb = Clipboard()
cb.set_text(text)
cb.store()

def paste_gtk():
clipboardContents = gtk.Clipboard().wait_for_text()
clipboardContents = Clipboard().wait_for_text()
# for python 2, returns None if the clipboard is blank.
if clipboardContents is None:
return ''
Expand Down Expand Up @@ -526,7 +526,7 @@ def determine_clipboard():
accordingly.
'''

global Foundation, AppKit, gtk, qtpy, PyQt4, PyQt5
global Foundation, AppKit, Clipboard, qtpy, PyQt4, PyQt5

# Setup for the CYGWIN platform:
if 'cygwin' in platform.system().lower(): # Cygwin has a variety of values returned by platform.system(), such as 'CYGWIN_NT-6.1'
Expand Down Expand Up @@ -558,7 +558,7 @@ def determine_clipboard():
# Setup for the LINUX platform:
if HAS_DISPLAY:
try:
import gtk # check if gtk is installed
from gtk import Clipboard # check if gtk is installed
except ImportError:
pass # We want to fail fast for all non-ImportError exceptions.
else:
Expand Down