Sublime Forum

Best lightweight option for plugin GUI?

#1

I’ve seen that a few people have implemented Tkinter and wxpython.

What is the best option to integrate with a package, including unmentioned alternatives?
( best == easy to implement + least requirements on user side + cross-platform )

 
Basically, what I’m looking to implement is a simple toggle popup, which can be positioned relative to the user screen:

 
Ideally, the GUI will be capable of displaying borderless windows to achieve the effect shown above.
 



 
I have worked with view.show_popup, but find it’s location parameter to be rather limited.

The issue is that location is relative to the active document and seems to correspond to characters in the document, rather than any x or y coordinate.  I’d prefer to work with absolute coordinates, in order to easily center GUI positions.

 
Apart from the toggle popup, I’d also like to experiment with interface options related to some plugins I’m working on.

1 Like

#2

So, besides a pop-up relative to the window, what is your end goal? If you just want simple notifications, maybe something like this would be helpful: https://github.com/facelessuser/SubNotify. This plugin displays notifications by calling out to external programs.

To be honest, no matter what you are looking for, the solution will most likely require the same thing: calling an external process. All plugins that currently popup any kind of GUI are calling external processes because there isn’t a a built-in, usable GUI library included with the Python that is included with Sublime.

ColorPicker pops up a colorpicker GUI via external processes: https://packagecontrol.io/packages/ColorPicker.

I have also created other plugins that do something similar (not available on Package Control): https://github.com/facelessuser/ColorSchemeEditor.

I’m not saying it isn’t possible to somehow shoehorn something like tkinter into Sublime (I really don’t know and having tried), but no one (or no one I can think of) does this.

1 Like

#3

 

My actual usage case for now is just a toggle notification centered on the user screen as shown in the image above.

Pretty much, if I add a feature like your Theme Tweaker: Toggle Tweak Mode, I’d like to display the notification for a user-defined amount of time.
 

 
For my multi-file macro plugin, I’d like to do the same but show the notification until the macro is complete.  Maybe include a progress bar as shown in my proof of concept.
 


 
I guess I’m just being nitpicky about the placement since I can technically do everything I need between view.show_popup & mdpopups.
 


 
Also, I’d like to just mess around with GUIs & see if I can come up with any other uses or plugin ideas.

I can definitely work with a GUI library, as I’m familiar with AHK & Android, but I’m not familiar with working with external processes as you mentioned.  I checked out your ColorPicker code & think I might need to work on a good amount of new skills to pull something like that off.  :dizzy_face:

0 Likes