Quote:
Originally Posted by Doitsu
If you have a Windows machine, you could use the win32gui library to find the Sigil title bar text. Here's a quick & dirty solution:
Code:
import win32gui
from win32gui import GetWindowText
class_name = 'Qt5QWindowIcon'
window_name = None
hwnd = win32gui.FindWindow(class_name, window_name)
if hwnd:
print GetWindowText(hwnd)
# returns 'untitled.epub - Sigil'
Note that this simple code will return the title bar text of the Qt app that was opened last. I.e. if you open multiple Sigil windows, you'll only get the title bar text of the last window and if you open Calibre (or any other Qt5 app) after Sigil, you'll get the Calibre title bar text.
For a more robust solution, you'll need to enumerate all windows using win32gui.EnumWindows.
|
When I run the code in your post, I got 'Plugin Runner' instead. It's really a dirty solution. And I doubt whether the method of enumerating all windows could get the right title I need.
Thanks anyway.