1

I want to creat some small app on Windows using python and QT (PyQt), and I want to embededd into this app ssh console. I try to use PuTTY and KiTTY, but I can't remove border (WS_BORDER , WS_CAPTION) at all.

exePath = "putty.exe sample_login@sample_host"
subprocess.Popen(exePath) # Run SSH Putty session
time.sleep(1)

hwnd = win32gui.FindWindowEx(0, 0, None, "sample_host - PuTTY") # Get hwnd of started putty 
style = win32gui.GetWindowLong(hwnd, win32con.GWL_STYLE)

print("hwnd ",hwnd)
print("style ", style)
style = style - int(win32con.WS_CAPTION) - int(win32con.WS_THICKFRAME)
print("style after ", style)
win32gui.SetWindowLong(hwnd, win32con.GWL_STYLE, style) # Apply modified style to Putty windidow

# Here my Putty windows looks exacly what I want - it show only SSH console and scroolbar, without titlebar, close button, frame, border etc.


self.window = QWindow.fromWinId(hwnd)
self.widget = QWidget.createWindowContainer(self.window, self)
self.widget.resize(600, 600)
self.widget.move(50, 50)

self.setGeometry(100, 100, 900, 900)
self.setWindowTitle('Putty test')
self.show()

# Here my Putty windows was already appended to PyQt app, but border / frame  was appear.

I try mixing few Windows Style but I can't achieve this. I also try this trick with some other app like notepad or Windows calc and in this case all works ok ( app was embedded without border/frame )

Below is screen of situation which I have before embedded Putty and after. I try to achieve situation as on the left after embedding window ( display only console ). enter image description here

1 Answers1

0

have you tried self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

bcarroll
  • 1,727
  • 16
  • 14