python 思维导图开发包_Python mekk.xmind包_程序模块 - PyPI - Python中文网

示例

创建思维导图:from mekk.xmind import XMindDocument

OUTPUT = "test.xmind"

xmind = XMindDocument.create(u"First sheet title", u"Root subject")

first_sheet = xmind.get_first_sheet()

root_topic = first_sheet.get_root_topic()

root_topic.add_subtopic(u"First item")

root_topic.add_subtopic(u"Second item")

t = root_topic.add_subtopic(u"Third item")

t.add_subtopic(u"Second level - 1")

t.add_subtopic(u"Second level - 2")

root_topic.add_subtopic(u"Detached topic", detached = True)

t.add_subtopic(u"Another detached", detached = True)

t.add_marker("flag-red")

root_topic.add_subtopic(u"Link example").set_link("http://mekk.waw.pl")

root_topic.add_subtopic(u"Attachment example").set_attachment(

file("map_creator.py").read(), ".txt")

root_topic.add_subtopic(u"With note").set_note(u"""This is just some dummy note.""")

MARKER_CODE = "40g6170ftul9bo17p1r31nqk2a"

XMP = "../../py_mekk_nozbe2xmind/src/mekk/nozbe2xmind/NozbeIconsMarkerPackage.xmp"

root_topic.add_subtopic(u"With non-standard marker").add_marker(MARKER_CODE)

xmind.embed_markers(XMP)

xmind.save(OUTPUT)

#xmind.pretty_print()

print "Saved to", OUTPUT

注意:虽然上面的示例使用ascii,但完全支持unicode

解析思维导图:from mekk.xmind import XMindDocument

xmind = XMindDocument.open("test.xmind")

sheet = xmind.get_first_sheet()

print "Sheet title: ", sheet.get_title()

root = sheet.get_root_topic()

print "Root title: ", root.get_title()

print "Root note: ", root.get_note()

for topic in root.get_subtopics():

print "* ", topic.get_title()

print " label: ", topic.get_label()

print " link: ", topic.get_link()

print " markers: ", list(topic.get_markers())

# topic.get_subtopics()

要修改,只需解析现有文档,找到要修改的项

根据需要更改它们,然后保存

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值