SOLVED how to make vanilla.Window not disappear
RafaŁ Buchner last edited by gferreira
hi (hehe, me again)
how to make simple vanilla.Window not disappear programmatically when the RoboFont app is becoming inactive?
from vanilla import * class simpleWin: def __init__(self): self.w = FloatingWindow((200,200)) self.w.open() simpleWin()
If I will run the code above in the RF, and change the active app to any another (let's say Finder), I see only default RF windows like script window, font window or glyph window. I would like my simpleWin also be visible in that case. Is it possible?
I realized that Erik's design space extension does it.
I was trying to find it in its code. Somehow I could not.
Any help would be appreciated
colinmford last edited by colinmford
FloatingWindows are meant to act like NSPanel, which hide when the app is unfocused.
If you want a standard window that stays open when you leave the app (like erik's), use the vanilla class
from vanilla import * class WindowDemo(object): def __init__(self): self.w = Window((200, 70), "Window Demo") self.w.myButton = Button((10, 10, -10, 20), "My Button") self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box") self.w.open() WindowDemo()
gferreira last edited by gferreira
if you want a window to stay visible when the app focus changes, it is recommended to use
from vanilla import Window, FloatingWindow class SimpleWindow: def __init__(self): self.w = Window((200,200), 'Window') self.w.open() class SimpleFloatingWindow: def __init__(self): self.w = FloatingWindow((200,200), 'FloatingWindow') self.w.open() SimpleWindow() # this one stays visible when RF is inactive SimpleFloatingWindow() # this one does not
if you really need a
FloatingWindowwhich stays visible (like the Output Window, for example), it can be done by tweaking the native window object:
from vanilla import FloatingWindow class SpecialFloatingWindow: def __init__(self): self.w = FloatingWindow((200,200), 'SpecialFloatingWindow') self.w.getNSWindow().setHidesOnDeactivate_(False) self.w.open() SpecialFloatingWindow()
edit: written before reading @colinmford’s reply…
RafaŁ Buchner last edited by
Thanks Gustavo!!! That is exacly what I needed