KiCAD 最小 pcbnew 插件示例
以下 python 脚本或多或少是我们之前文章 如何在 KiCAD pcbnew 插件中显示 wx 对话框消息 中 KiCAD pcbnew 插件的最小示例。
DialogExamplePlugin.py
#!/usr/bin/env python
import pcbnew
import wx
class DialogExamplePlugin(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Show dialog example"
self.category = "A descriptive category name"
self.description = "A description of the plugin and what it does"
self.show_toolbar_button = False # Optional, defaults to False
def Run(self):
dlg = wx.MessageDialog(None, "Please select one or multiple footprints!\n...or use Ctrl+A to select everything.", "No footprints selected", wx.OK | wx.ICON_ERROR)
dlg.ShowModal()
dlg.Destroy()
DialogExamplePlugin().register() # Instantiate and register to Pcbnew你可以将此插件放在例如
plugin_path.txt
~/.local/share/kicad/7.0/scripting/plugins/DialogExamplePlugin.py不要忘记从 pcbnew 菜单刷新插件。
如果这篇文章对你有帮助,请考虑给我买杯咖啡或通过 PayPal 捐款以支持 TechOverflow 的研究和发布新文章
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow