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

KeyError: 'document' #203

Open MyGuyCai opened 2 years ago

MyGuyCai commented 2 years ago

Hi, I need to work on the UI for an application I have built.

here are the steps I've done to try and get tkdesigner to work: installed python3.9 added python to path

pip install tkdesigner tkdesigner $FILE_URL $FIGMA_TOKEN

here is my file url: https://www.figma.com/file/W3ekOTW6bFvGiUrndEpC4S/Untitled?node-id=4%3A41

The callback I get is: Traceback (most recent call last): File "C:\Users\Cai\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Cai\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Cai\AppData\Local\Programs\Python\Python39\Scripts\tkdesigner.exe__main__.py", line 7, in File "C:\Users\Cai\AppData\Local\Programs\Python\Python39\lib\site-packages\tkdesigner\cli.py", line 71, in main designer.design() File "C:\Users\Cai\AppData\Local\Programs\Python\Python39\lib\site-packages\tkdesigner\designer.py", line 29, in design code = self.to_code() File "C:\Users\Cai\AppData\Local\Programs\Python\Python39\lib\site-packages\tkdesigner\designer.py", line 21, in to_code window_data = self.file_data["document"]["children"][0]["children"][0] KeyError: 'document'

Any ideas what I've missed?

MyGuyCai commented 2 years ago

After reading through other issues trying to find one similar I tried running tkdesigner through the GUI which has worked, guessing there is an issue with CLI or maybe I was doing something wrong. Either way got it to work!

jiuerbujie commented 2 years ago

the same error, even failed using GUI

aditdesai commented 2 years ago

Did anyone find a solution?

abdulkadirhuzeifa commented 2 years ago

hey @aditdesai @MyGuyCai @jiuerbujie

i see you have python installed but your running in it wrong directory mate.

open a fresh terminal or cmd and run these commands in order:

git clone https://github.com/ParthJadhav/Tkinter-Designer.git cd tkinter-designer pip3 install -r requirements.txt pip3 install tkdesigner cd tkinter-designer (optional: only if u arent still in tkinter-designer directory after the pip3 steps) cd gui python3 gui.py

MyGuyCai commented 2 years ago

@AbdulkadirH5253 Can confirm this works, running the UI with pip gui.py allows me to get my designs

Esavwede commented 7 months ago

I found a Solution: The cause of the error for me was an expired Figma Token

This is the error I got the error: " tkinter KeyError: 'document' "

self.file_data.['document'] was undefined because self.file_data was equal to an error object

Screenshot 2024-01-17 213106

To Fix the error, create a new Figma Token