Build QT UI in python module to run DRC

Hi there!

I am currently trying to write some python UI module, basically using a bunch of checkboxes for the DRC file that you wanna execute, and once you checked the check box then you press a button, it will start to execute the bunch of DRC file. \

I wonder what the API call for running the DRC file in the python module.

Thank you very much
Andy

Comments

  • Yes, exactly. This is your friend :)

    Matthias

  • That's all the way to the bottom of the turtle-pond, yep.
    Turtles, turtles, turtles.

    Please post your work once you get it solved so the
    less (or not at all) clueful among us, can get some
    traction.

  • edited June 2022

    yes here is some stack overflow level sample code for people who just getting started

      def button_clicked(self, checked):
    
            basePath = r"C:\Users\KLayout\drc\10-Corner85.lydrc"
            testPath = r"C:\Users\KLayout\drc"
            runArray = []
            for x in os.listdir(testPath):
                if(getattr(self, x).isChecked() == True):
                    print(os.path.join(testPath, x))
                    runArray.append(os.path.join(testPath, x))
            for i in runArray:
                pya.Macro(i).run()
    

    pya.Macro(i).run is the key to it

    also here is something interesting how to pass a variable to the macro that you wanna run

        def button_clicked(self, checked):
            outputPath = r"D:\All_Code\PythonCode\klayout\code\output_prompt.py"
            testParm = pya.Value(20)
            someInterpreter = pya.Interpreter().python_interpreter().define_variable("peepee", testParm)
            pya.Macro(outputPath).run()
            self.image.setText("GIGGITY")
    

    here is the code inside output_prompt.py

    print(peepee.value + 30)
    

    and the output is 50

Sign In or Register to comment.