Writing gimp plugins in python on windows- how do i debug? where is the output?

前端 未结 3 2039
不思量自难忘°
不思量自难忘° 2021-02-02 11:52

EDITED HEAVILY with some new information (and a bounty)

I am trying to create a plug in in python for gimp. (on windows) this page http://gimpbook.com/scripting/notes.ht

3条回答
  •  情话喂你
    2021-02-02 12:53

    I am a newbie to python, but I would like to give a shout-out, first to winpdb, and then to this comment for integrating winpdb into GIMP. This same procedure works as well for LibreOffice 4.

    If I may be allowed to vent a little; I have a moderate amount of experience with Visual Basic, more or less at a hobbiest level, but I decided a few years ago to get into OpenOffice when MicroSoft threatened to abandon VB for the Mac. I don't want to say that VB in OpenOffice was onerous, but the lack of anything resembling an IDE is tedious. Now, with winpdb, I will never be looking back. It's python from here on out, baby.

    Steps taken:

    -- As suggested by Omid above, I first got winpdb running out of GIMP (relatively painless).

    -- I copied the rpdb2.py file to C:\Program Files\LibreOffice 4\program\python-core-3.3.3\lib\site-packages\rpdb2.py. (Win 7, LibreOffice 4.4.03)

    -- I edited the HelloWorld.py file in C:\Program Files\LibreOffice 4\share\Scripts\python directory (saved in WinPDb_HelloWorld.py to same directory).

    # HelloWorld python script for the scripting framework
    # This file is part of the LibreOffice project.
    # This Source Code Form is subject to the terms of the Mozilla Public
    # License, v. 2.0. blah, blah, blah ...
    
    import rpdb2
    #rpdb2.start_embedded_debugger("Your Password Here")    # << DON'T start debugger here.
        # It only gets you lost in the LO python wrapper when debugging.
    
    def HelloWorldPython( ):
        """Prints the string 'Hello World(in Python)' into the current document"""
    
        # start debugger INSIDE function, where it will be called from LO Macros -- Duh!!
        rpdb2.start_embedded_debugger("YourPasswordHere") 
    
        #get the doc from the scripting context which is made available to all scripts
        desktop = XSCRIPTCONTEXT.getDesktop() 
        #... etc., see HelloWorld.py
    

    WinPDb_HelloWorld appears under LibreOffice Macros in the Macro Selector (see https://wiki.openoffice.org/wiki/Python_as_a_macro_language for more on that).

    (can't show you a picture - posting as a guest)

提交回复
热议问题