magicgui icon indicating copy to clipboard operation
magicgui copied to clipboard

Set window title

Open tlambert03 opened this issue 5 years ago • 2 comments

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 avatar Jan 25 '21 02:01 tlambert03

@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'

qianxuanyon avatar Sep 12 '24 09:09 qianxuanyon

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)

tlambert03 avatar Sep 12 '24 11:09 tlambert03