Python-Ref > Cheminformatics > BKChem scripting > BKChem plugins

Klíčová slova
Knihovní funkce

BKChem plugins

How to write code snippets that can be run from BKChem menu.
A simple plugin is described here.
The following batch script can be used to add summary formula and composition below each molecule.
<?xml version="1.0" encoding="utf-8"?>
    <author>Beda Kosata</author>
    <menu-text>Add summary formula below molecules</menu-text>
Zdroj: (
  1   App.paper.unselect_all()
  3   for mol in App.paper.molecules:
  4     sumform = mol.get_formula_dict()
  5     txt = App.paper.new_text( 0, 0, text=sumform.get_html_repr_as_string())
  6     txt.draw()
  7 mol)
  8     App.paper.place_next_to_selected( "b", "v", 10, txt)
  9     App.paper.unselect_all()
Program screenshot bkchem1-1a.pngProgram screenshot bkchem1-1b.png
Doba běhu: 5.0 ms