MCPcopy
hub / github.com/pandas-dev/pandas / init_qt_clipboard

Function init_qt_clipboard

pandas/io/clipboard/__init__.py:136–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135
136def init_qt_clipboard():
137 global QApplication
138 # $DISPLAY should exist
139
140 # Try to import from qtpy, but if that fails try PyQt5 then PyQt4
141 try:
142 from qtpy.QtWidgets import QApplication
143 except ImportError:
144 try:
145 from PyQt5.QtWidgets import QApplication
146 except ImportError:
147 from PyQt4.QtGui import QApplication
148
149 app = QApplication.instance()
150 if app is None:
151 app = QApplication([])
152
153 def copy_qt(text):
154 text = _stringifyText(text) # Converts non-str values to str.
155 cb = app.clipboard()
156 cb.setText(text)
157
158 def paste_qt() -> str:
159 cb = app.clipboard()
160 return str(cb.text())
161
162 return copy_qt, paste_qt
163
164
165def init_xclip_clipboard():

Callers 2

set_pyqt_clipboardFunction · 0.90
determine_clipboardFunction · 0.85

Calls

no outgoing calls

Tested by 1

set_pyqt_clipboardFunction · 0.72