notebookvb
This commit is contained in:
@@ -81,19 +81,32 @@ def main():
|
||||
root.update_idletasks()
|
||||
sw = root.winfo_screenwidth()
|
||||
w = root.winfo_width()
|
||||
h = root.winfo_height()
|
||||
x = (sw - w) // 2
|
||||
|
||||
# Skutečná použitelná výška (bez taskbaru)
|
||||
import ctypes, ctypes.wintypes
|
||||
rect = ctypes.wintypes.RECT()
|
||||
ctypes.windll.user32.SystemParametersInfoW(48, 0, ctypes.byref(rect), 0)
|
||||
work_bottom = rect.bottom # spodní hrana work area
|
||||
|
||||
# Pozice pod preview oknem pokud byl předán argument --below-y=N
|
||||
below_y = None
|
||||
for arg in sys.argv:
|
||||
if arg.startswith("--below-y="):
|
||||
below_y = int(arg.split("=", 1)[1])
|
||||
break
|
||||
y = below_y if below_y is not None else (root.winfo_screenheight() - root.winfo_height() - 60)
|
||||
|
||||
if below_y is not None and below_y + h + 10 <= work_bottom:
|
||||
y = below_y # vejde se pod preview
|
||||
else:
|
||||
y = max(0, work_bottom - h - 10) # přilepit těsně nad taskbar
|
||||
root.geometry(f"+{x}+{y}")
|
||||
|
||||
root.lift()
|
||||
root.focus_force()
|
||||
root.after(100, lambda: root.focus_force())
|
||||
root.after(200, lambda: root.attributes("-topmost", True))
|
||||
root.mainloop()
|
||||
|
||||
print(json.dumps({"value": result["value"]}, ensure_ascii=False))
|
||||
|
||||
Reference in New Issue
Block a user