Creating frames, panels, popup windows etc

Help
2011-01-05
2013-01-25
  • Kevin Sheedy
    Kevin Sheedy
    2011-01-05

    Is it possible to use nppPythonScript to create frames and popup windows like a full blown plugin.
    For instance, the "Function List" plugin creates a panel containing a list of functions.
    The "Plugin Manager" plugin creates a popup with multiple tabs and options.
    Can nppPythonScript do this?

    Thanks

     
  • Ha- good question.  The answer is, yes and no. Some things are really easy - like a message box is just notepad.messageBox('Hello world')  - there's a few options to say which buttons are there, and which icon to use and so on.  To prompt the user for input, just use notepad.prompt('The Prompt', 'Window Title', 'default').  It will return None if the user clicks cancel.  Those were the two things that I thought people would use often, so they're very easy to do.

    Full blown windows & forms requires an extra library.  The "normal" library for python is the Tcl/Tk library, but there are several others that may work better / easier.  Make sure you use 0.8 of PythonScript if you give this a go - I must admit I've not tried it yet - installation is non-trivial (you might have to copy some DLLs around, after you've installed tcl/tk).  My advice would be to get some results with normal Python first, then try and make it work in N++ - I'd love to hear your feedback if you get it going!

    Joce and I have been working on the next version of PythonScript, which has improved support for the modules - so all the modules (.pyd) are available, and (will) pass the Python test suite.  Unfortunately work took over my life in December, so things are only just now settling down so I can get back to it and finish it off.  If you give it a go (with whatever library - some of the others might be easier to make work) - post your results, especially if there's something that needs fixing, then we can get it in the next version.

    As for docked windows - I doubt you can get this to work with things as they are - you need to communicate some things about the window to Notepad++, in such a way that would be very difficult to do in Python alone.  If you get some success with a windows library, we can always add the relevant bits in to make that work (or at least try to!)

    Not a straight forward answer, sorry, but, the good news is, things are getting better! 

    Good luck,
    Dave.