Sublime Forum

GUI code

#1

I know ST1 had the ability to pop up a Yes/No question box to the user, but it looks like that hasn’t been implemented in ST2 yet.

Even when it is, it doesn’t fit what I’m looking to do – prompt the user for their password when trying to save a file that needs to be checked out of version control. I was thinking of trying to pop up a window using Tkinter, but it looks like I can’t initialize Tkinter from within a plugin.

Has anyone else given this a try? And on the off chance that Jon reads this, would you be willing to consider, in addition to the question box / alert functions, some kind of simple textfield data entry function? I’m picturing something like:

[code]data = sublime.data_entry_box(“Please enter your username and password:”, {“label”:“User”, “default”:“MyUserName”}, {“label”:“Password”, “hide”:True})

if (data):
print(“User: %s; Pass: %s” % (data"User"], data"Password"]))[/code]

0 Likes

#2

You do have the option of using an input panel - take a look at Default/goto_line.py

0 Likes

#3

That actually works pretty well – is there a way to hide the input (as for a password panel)?

0 Likes

#4

This is as good a thread as any to make a suggestion (which I already filed in userecho). Would it be possible to expose the platform’s native HTML renderer, i.e. WebKit on OSX and WebBrowser on Windows (and whatever is easiest to get working on Linux)? This would largely solve UI issues, as one could create an HTML form and ship it out, with the OS taking care of rendering issues.

Just a thought.

0 Likes