magicgui
magicgui copied to clipboard
Set window title
As mentioned by @HagaiHargil in https://github.com/napari/magicgui/issues/107#issuecomment-762935341, there should be an API for editing the widget window title (or at the very least, it should be set as the Container widget name
@tlambert03
from typing import Annotated, Literal
from magicgui import magicgui
from magicgui.widgets import TextEdit
@magicgui(text_output={'widget_type': TextEdit},result_widget=True,main_window=True,)
def my_function(
param_a: int,
param_b: Annotated[int, {'widget_type': "Slider", 'max': 100}] = 42,
param_c: Literal["First", "Second", "Third"] = "Second",
text_output:str = '',
)->str:
''' hello '''
print("param_a:", param_a)
print("param_b:", param_b)
print("param_c:", param_c)
my_function.native.setWindowTitle('Window Title')
my_function.show(run=True)
my_function.annotation='hello'
Yes using native works. I think the point of this issue was to suggest that there should be a magicgui API (without having to resort to the native widget API)