Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions pyautogui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ def isShiftCharacter(character):
else:
raise NotImplementedError("Your platform (%s) is not supported by PyAutoGUI." % (platform.system()))

def reinit():
if platform.system() == "Linux":
platformModule.reinit_display()

# TODO: Having module-wide user-writable global variables is bad. It makes
# restructuring the code very difficult. For instance, what if we decide to
# move the mouse-related functions to a separate file (a submodule)? How that
Expand Down
3 changes: 3 additions & 0 deletions pyautogui/_pyautogui_x11.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ def _keyUp(key):
# Taken from PyKeyboard's ctor function.
_display = Display(os.environ['DISPLAY'])

def reinit_display():
_display = Display(os.environ['DISPLAY'])


""" Information for keyboardMapping derived from PyKeyboard's special_key_assignment() function.

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
test_suite='tests',
install_requires=['pyobjc-core;platform_system=="Darwin"',
'pyobjc-framework-quartz;platform_system=="Darwin"',
'python3-Xlib;platform_system=="Linux" and python_version>="3.0"',
'python-xlib;platform_system=="Linux" and python_version<"3.0"',
'python-xlib;platform_system=="Linux"',
'pymsgbox',
'pytweening>=1.0.4',
'pyscreeze>=0.1.21',
Expand Down