ParthJadhav / Tkinter-Designer

An easy and fast way to create a Python GUI 🐍
BSD 3-Clause "New" or "Revised" License
8.96k stars 821 forks source link

[Error] Some elements were generated as Black Rectangles #181

Closed ralphg6 closed 2 years ago

ralphg6 commented 2 years ago

How to Fix ? A key error occurs when the elements are named or grouped incorrectly. Before creating an issue, make sure that you have followed the instructions guide correctly.

If the issue still persists, create an issue with the following details included.

  1. Error Message

Output console with LATEST Release (1.0.4) and master branch:

Creating Element { name: Rectangle 1, type: RECTANGLE }
Element with the name: `Rectangle 1` cannot be parsed. Would be displayed as Black Rectangle
Creating Element { name: Line 1, type: LINE }
Element with the name: `Line 1` cannot be parsed. Would be displayed as Black Rectangle
Creating Element { name: Rectangle 2, type: RECTANGLE }
Element with the name: `Rectangle 2` cannot be parsed. Would be displayed as Black Rectangle
Creating Element { name: Abrir DIAR, type: TEXT }

Project successfully generated at E:\desenv\Tkinter-Designer\build.

When I build my project some elements were generated as Black Rectangles...

  1. Link to the Figma File: https://www.figma.com/file/figS9H9KQIWrDICdjLWh1g/BB-Escritura%C3%A7%C3%A3o---Central-de-Solu%C3%A7%C3%B5es?node-id=0%3A1

Snippet File Data exported by API:

{
  "document": {
    "id": "0:0",
    "name": "Document",
    "type": "DOCUMENT",
    "children": [
      {
        "id": "0:1",
        "name": "Page 1",
        "type": "CANVAS",
        "children": [
          {
            "id": "1:2",
            "name": "Desktop - 1",
            "type": "FRAME",
            "blendMode": "NORMAL",
            "children": [
              {
                "id": "1:3",
                "name": "Rectangle 1",
                "type": "RECTANGLE",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokes": [],
                "strokeWeight": 1.0
              },
              {
                "id": "1:5",
                "name": "Line 1",
                "type": "LINE",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [],
                "strokes": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokeWeight": 5.0
              },
              {
                "id": "1:7",
                "name": "Rectangle 2",
                "type": "RECTANGLE",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokes": [],
                "strokeWeight": 1.0
              },
              {
                "id": "1:8",
                "name": "Abrir DIAR",
                "type": "TEXT",
                "blendMode": "PASS_THROUGH",
                "absoluteBoundingBox": {...},
                "constraints": {...},
                "fills": [{"blendMode": "NORMAL", "type": "SOLID", "color": {...}}],
                "strokes": [],
                "strokeWeight": 1.0
              }
            ],
            "absoluteBoundingBox": {...},
            "constraints": {...},
            "clipsContent": true,
            "background": []
          }
        ],
        "backgroundColor": {...},
        "prototypeStartNodeID": null,
        "flowStartingPoints": [],
        "prototypeDevice": {...}
      }
    ]
  },
  "components": {...},
  "componentSets": {...},
  "schemaVersion": 0,
  "styles": {...},
  "name": "Untitled",
  "lastModified": "2022-01-18T00:25:42Z",
  "thumbnailUrl": "https://s3-alpha-sig.figma.com/thumbnails/5525c6fe-a3aa-47be-8356-6a99d3c3b9fc?Expires=1643587200&Signature=gg8HDn3u6lnfjRzlaPRyEv4c6cxKUbMot5iRFwyk7IRqiKhcicCkmZocH6YKE537obHp~Rr4DFQCKqG3AKP3wPzU6yA~9AaFANJKYikaZzT5u2RhFm1i5m~ZorpM2TTNEAsOe5ZFzW8Z~zl-yTv1zKJh0ZmZUnTR86ZuL~qD3WTGUBNsTjEMlykDn0qSM6GyRO6EZybs47qCZLOXPBLZ1u1sw0ksJw68g6gK6QwYRPgWfcmXQKI55uk95aAP8ObOLRFke3c1ZRhtpdRJlEuKDSBf~LbmzxMWvX5QnmR-45GGiOl6d~PFnb3O7KpWogounAYFhd5vnsIAoW9i7dPtnw__&Key-Pair-Id=APKAINTVSUGEWH5XD5UA",
  "version": "1465422841",
  "role": "owner",
  "editorType": "figma",
  "linkAccess": "inherit"
}
ralphg6 commented 2 years ago

I propose a fix in PR #180

ParthJadhav commented 2 years ago

Hey Ralph, I saw the PR and the main reason the code was producing black rectangles was that you did not follow the naming guide.

https://github.com/ParthJadhav/Tkinter-Designer/blob/master/docs/instructions.md#formatting-your-figma-design-top

ParthJadhav commented 2 years ago

Thanks for the changes and working on them. But the changes you made would break the code. I'll tell the reasons in the comments of the code itself.