Gh0stSimpleDiagramTool


NameGh0stSimpleDiagramTool JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/gh0stintheshe11/gh0st-SImpleDiagramTool
SummaryA simple diagram drawing tool
upload_time2024-03-14 17:35:22
maintainer
docs_urlNone
authorgh0stintheshe11
requires_python
licenseMIT
keywords diagram flowchart matplotlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SimpleDiagramTool

`SimpleDiagramTool` is a Python class that provides a simple interface for creating diagrams using matplotlib. It allows you to add blocks, lines, and arrows to a diagram, and then display the diagram.

## Installation

This tool requires matplotlib to be installed. You can install it using pip:

```bash
pip install matplotlib
```

## Usage

First, import the `SimpleDiagramTool` class:

```python
from simple_diagram_tool import SimpleDiagramTool
```

Then, create an instance of the class, specifying the length and width of the diagram:

```python
diagram = SimpleDiagramTool(10, 10)
```

### Adding a block

You can add a block to the diagram using the `add_block` method. This method takes the following parameters:

- `position`: A tuple `(x, y)` specifying the bottom left corner of the block.
- `size`: A tuple `(width, height)` specifying the size of the block.
- `label`: A string label for the block.
- `boundary_color`: (optional) The color of the block boundary. Default is 'r' (red).
- `text_size`: (optional) The size of the label text. Default is 10.

```python
diagram.add_block((1, 1), (2, 2), 'Block 1', boundary_color='b', text_size=12)
```

### Adding a line

You can add a line to the diagram using the `add_line` method. This method takes the following parameters:

- `start_pos`: A tuple `(x, y)` specifying the start position of the line.
- `end_pos`: A tuple `(x, y)` specifying the end position of the line.
- `line_color`: (optional) The color of the line. Default is 'k' (black).

```python
diagram.add_line((1, 1), (3, 3), line_color='g')
```

### Adding an arrow

You can add an arrow to the diagram using the `add_arrow` method. This method takes the following parameters:

- `start_pos`: A tuple `(x, y)` specifying the start position of the arrow.
- `end_pos`: A tuple `(x, y)` specifying the end position of the arrow.
- `arrow_color`: (optional) The color of the arrow. Default is 'k' (black).

```python
diagram.add_arrow((1, 1), (3, 3), arrow_color='r')
```

### Displaying the diagram

Finally, you can display the diagram using the `show` method:

```python
diagram.show()
```

## Error Handling

If you try to add an element that is out of the bounds of the diagram, a `ValueError` will be raised. Make sure that all elements fit within the specified length and width of the diagram.

## Examples

Here's a complete example that creates a diagram with a block, a line, and an arrow:

```python
from simple_diagram_tool import SimpleDiagramTool

diagram = SimpleDiagramTool(10, 10)
diagram.add_block((1, 1), (2, 2), 'Block 1', boundary_color='b', text_size=12)
diagram.add_line((1, 1), (3, 3), line_color='g')
diagram.add_arrow((1, 1), (3, 3), arrow_color='r')
diagram.show()
```

This will create a 10x10 diagram with a blue block labeled 'Block 1' at position (1, 1) with size (2, 2), a green line from (1, 1) to (3, 3), and a red arrow from (1, 1) to (3, 3).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/gh0stintheshe11/gh0st-SImpleDiagramTool",
    "name": "Gh0stSimpleDiagramTool",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "diagram flowchart matplotlib",
    "author": "gh0stintheshe11",
    "author_email": "gh0stintheshe11@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5e/f7/1d51deadf77c56c7c0d6ba84de1bbbd67643c538a949237cef9f97bbf184/Gh0stSimpleDiagramTool-0.0.4.tar.gz",
    "platform": null,
    "description": "# SimpleDiagramTool\n\n`SimpleDiagramTool` is a Python class that provides a simple interface for creating diagrams using matplotlib. It allows you to add blocks, lines, and arrows to a diagram, and then display the diagram.\n\n## Installation\n\nThis tool requires matplotlib to be installed. You can install it using pip:\n\n```bash\npip install matplotlib\n```\n\n## Usage\n\nFirst, import the `SimpleDiagramTool` class:\n\n```python\nfrom simple_diagram_tool import SimpleDiagramTool\n```\n\nThen, create an instance of the class, specifying the length and width of the diagram:\n\n```python\ndiagram = SimpleDiagramTool(10, 10)\n```\n\n### Adding a block\n\nYou can add a block to the diagram using the `add_block` method. This method takes the following parameters:\n\n- `position`: A tuple `(x, y)` specifying the bottom left corner of the block.\n- `size`: A tuple `(width, height)` specifying the size of the block.\n- `label`: A string label for the block.\n- `boundary_color`: (optional) The color of the block boundary. Default is 'r' (red).\n- `text_size`: (optional) The size of the label text. Default is 10.\n\n```python\ndiagram.add_block((1, 1), (2, 2), 'Block 1', boundary_color='b', text_size=12)\n```\n\n### Adding a line\n\nYou can add a line to the diagram using the `add_line` method. This method takes the following parameters:\n\n- `start_pos`: A tuple `(x, y)` specifying the start position of the line.\n- `end_pos`: A tuple `(x, y)` specifying the end position of the line.\n- `line_color`: (optional) The color of the line. Default is 'k' (black).\n\n```python\ndiagram.add_line((1, 1), (3, 3), line_color='g')\n```\n\n### Adding an arrow\n\nYou can add an arrow to the diagram using the `add_arrow` method. This method takes the following parameters:\n\n- `start_pos`: A tuple `(x, y)` specifying the start position of the arrow.\n- `end_pos`: A tuple `(x, y)` specifying the end position of the arrow.\n- `arrow_color`: (optional) The color of the arrow. Default is 'k' (black).\n\n```python\ndiagram.add_arrow((1, 1), (3, 3), arrow_color='r')\n```\n\n### Displaying the diagram\n\nFinally, you can display the diagram using the `show` method:\n\n```python\ndiagram.show()\n```\n\n## Error Handling\n\nIf you try to add an element that is out of the bounds of the diagram, a `ValueError` will be raised. Make sure that all elements fit within the specified length and width of the diagram.\n\n## Examples\n\nHere's a complete example that creates a diagram with a block, a line, and an arrow:\n\n```python\nfrom simple_diagram_tool import SimpleDiagramTool\n\ndiagram = SimpleDiagramTool(10, 10)\ndiagram.add_block((1, 1), (2, 2), 'Block 1', boundary_color='b', text_size=12)\ndiagram.add_line((1, 1), (3, 3), line_color='g')\ndiagram.add_arrow((1, 1), (3, 3), arrow_color='r')\ndiagram.show()\n```\n\nThis will create a 10x10 diagram with a blue block labeled 'Block 1' at position (1, 1) with size (2, 2), a green line from (1, 1) to (3, 3), and a red arrow from (1, 1) to (3, 3).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple diagram drawing tool",
    "version": "0.0.4",
    "project_urls": {
        "Homepage": "https://github.com/gh0stintheshe11/gh0st-SImpleDiagramTool"
    },
    "split_keywords": [
        "diagram",
        "flowchart",
        "matplotlib"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4810f1b2b2575bda8cd7bd8ca360b0b225cd6465125b0b16c8c67e32244ef7f",
                "md5": "9d0fa8668e777bfb83118fed6db3f51d",
                "sha256": "753bec8ad3c7a7c23c0c5d24b066e9fe11175bbae344fa347b0fe7f0dadcfee0"
            },
            "downloads": -1,
            "filename": "Gh0stSimpleDiagramTool-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d0fa8668e777bfb83118fed6db3f51d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4401,
            "upload_time": "2024-03-14T17:35:20",
            "upload_time_iso_8601": "2024-03-14T17:35:20.762420Z",
            "url": "https://files.pythonhosted.org/packages/c4/81/0f1b2b2575bda8cd7bd8ca360b0b225cd6465125b0b16c8c67e32244ef7f/Gh0stSimpleDiagramTool-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ef71d51deadf77c56c7c0d6ba84de1bbbd67643c538a949237cef9f97bbf184",
                "md5": "9cfa1195655cc1d70afd3e39620b6034",
                "sha256": "327ad1f2e4afc63ae8f97a38e06ec54192be4dc8711457ed8823704c3f5bbc7f"
            },
            "downloads": -1,
            "filename": "Gh0stSimpleDiagramTool-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9cfa1195655cc1d70afd3e39620b6034",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3797,
            "upload_time": "2024-03-14T17:35:22",
            "upload_time_iso_8601": "2024-03-14T17:35:22.380472Z",
            "url": "https://files.pythonhosted.org/packages/5e/f7/1d51deadf77c56c7c0d6ba84de1bbbd67643c538a949237cef9f97bbf184/Gh0stSimpleDiagramTool-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-14 17:35:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gh0stintheshe11",
    "github_project": "gh0st-SImpleDiagramTool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gh0stsimplediagramtool"
}
        
Elapsed time: 0.20231s