Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents cb4f0d6 + 8cb17f8 commit c79514aCopy full SHA for c79514a
2 files changed
lib/matplotlib/backends/_backend_tk.py
@@ -44,7 +44,7 @@ def _restore_foreground_window_at_end():
44
try:
45
yield
46
finally:
47
- if mpl.rcParams['tk.window_focus']:
+ if foreground and mpl.rcParams['tk.window_focus']:
48
_c_internal_utils.Win32_SetForegroundWindow(foreground)
49
50
src/_c_internal_utils.cpp
@@ -111,7 +111,11 @@ static py::object
111
mpl_GetForegroundWindow(void)
112
{
113
#ifdef _WIN32
114
- return py::capsule(GetForegroundWindow(), "HWND");
+ if (HWND hwnd = GetForegroundWindow()) {
115
+ return py::capsule(hwnd, "HWND");
116
+ } else {
117
+ return py::none();
118
+ }
119
#else
120
return py::none();
121
#endif
0 commit comments