如何在Pycharm社区版中创建UML图?

kxe2p93d  于 2023-08-05  发布在  PyCharm
关注(0)|答案(3)|浏览(306)

是不是只能在Pycharm专业版中创建类图?我有Pycharm Community Edition 2019.2,我已经安装了PlantUML pluginGraphviz,还根据需要设置了环境变量,但仍然无法创建类图。

j9per5c4

j9per5c41#

基于在线搜索,我认为你的问题的具体答案是肯定的,你只能使用专业版的集成UML插件。要在Community Edition中实现这一点,正如Dinko所说,您必须使用第三方插件PlantUML。

nbysray5

nbysray52#

PyCharm中类的Generating UMLs默认包含在内。也许你已经禁用了它们。转到File -> Settings -> Plugins并搜索UML。应该有Python UML图和UML,下面应该有 bundled 关键字。
您可以右键单击class并选择Diagrams来生成它。
例如,这个类:

class Person:

    def __init__(self, name, age):
        self.name = name
        self.age = age

字符串
表示为:


的数据
对于PlantUML插件,除了插件本身,您不需要安装任何东西。安装时,您可以创建新的PlantUML文件并选择要生成的默认图。

t40tm48m

t40tm48m3#

def search_by_description():description = input(“输入要搜索的项目说明:“)

inventory = []
with open("inventory.txt", "r") as file:
    for line in file:
        data = line.strip().split("\t")
        inventory.append(data)

found = False
for item in inventory:
    if description.lower() in item[1].lower():
        found = True
        print("Item details:")
        print(f"Item Code: {item[0]}")
        print(f"Description: {item[1]}")
        print(f"Category: {item[2]}")
        print(f"Unit: {item[3]}")
        print(f"Price: {item[4]}")
        print(f"Quantity: {item[5]}")
        print(f"Minimum Threshold: {item[6]}")
        print()

if not found:
    print("No items found with the given description.")

字符串

相关问题