Consider this little piece of code:
import subprocess
import win32gui
import win32con
import time
import sys
from PyQt5.Qt
I found part of the issue wrt to closing. So when you are creating the self._window
in the attach
function and you close the MainWindow
, that other window (thread) is sitting around still. So if you add a self._window = None
in the __init__
function and add a __del__
function as below, that part is fixed. Still not sure about the lack of menu. I'd also recommend holding onto the subprocess handle with self.__p
instead of just letting that go. Include that in the __del__
as well.
def __del__(self):
self.__p.terminate()
if self._window:
print('terminating window')
self._window.close
Probably better yet would be to include a closeEvent
def closeEvent(self, event):
print('Closing time')
self.__p.terminate()
if self._window is not None:
print('terminating window')
self._window.close