← Back to team overview

kicad-developers team mailing list archive

Driving the pcbnew UI from python

 

Hello,

I'm developing a small Python application for tracking component inventory
& to help when assembling boards.  I'd like to be able to display a portion
of the board layout with a particular component centred.  This could either
be in my application window or in a separate window, I'm not too worried
which.  The display doesn't necessarily need to be interactive, though the
ability to pan & zoom would be nice to have.

What's the most straightforward way to do this in pcbnew currently?

I can see three possibilities:

1.  I think it's possible to launch pcbnew as a separate process and send
it messages to focus a particular component through KiWay.  Could someone
confirm that this is possible in a separate process and perhaps point me
towards some documentation or example code for how to do this in python.

2.  I think it's possible for a python process to be the 'top' for pcbnew -
so I should be able to load pcbnew in my python process and display the UI
and send it in-process KiWay messages.  Could someone confirm that this is
possible and again perhaps point me towards documentation or examples?

3.  I'm not sure if it's possible to load a board using the python
pcbnew.LoadBoard() and then render a portion of it in-memory, which I could
then display in my application.  Is this possible?

Thanks for any help,
Tom Cook

Follow ups