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

UnicodeEncodeError: 'charmap' codec can't encode character '\u1ea2' in position 1027: character maps to <undefined> #170

Closed thaisonho closed 2 years ago

thaisonho commented 2 years ago

Hi,

I'm trying to use the tool to convert my figma project but keep getting this message in the terminal.

Here's is the full thing that appeared on my screen

Traceback (most recent call last):
  File "C:\msys64\mingw64\lib\python3.9\tkinter\__init__.py", line 1892, in __call__
    return self.func(*args)
  File "D:\Files\Tkinter-Designer\gui\gui.py", line 72, in btn_clicked
    designer.design()
  File "D:\Files\Tkinter-Designer\tkdesigner\designer.py", line 30, in design
    self.output_path.joinpath(CODE_FILE_NAME).write_text(code)
  File "C:\msys64\mingw64\lib\python3.9\pathlib.py", line 1288, in write_text
    return f.write(data)
  File "C:\msys64\mingw64\lib\python3.9\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u1ea2' in position 1027: character maps to <undefined>

Here's my figma link: https://www.figma.com/file/dpC4gnlcNKtKrLRPfHBKNJ/GiaiPTb2

Thanks for your help.

ParthJadhav commented 2 years ago

Tkinter Designer struggles while converting Text from other languages than English...

You can add English text while converting the design and then add the original text directly to the code.

thaisonho commented 2 years ago

@ParthJadhav Thank you for helping me. It works totally fine when I change to English. But I came up with another problem is the corner radius of rectangle couldn't be transformed. Is there any ways to fix it?

Many thanks!

ParthJadhav commented 2 years ago

Sadly corner radius is not supported om rectangles. You can change the name of rectangle to "Image" this way it would be rendered as it is.

thaisonho commented 2 years ago

My code works fine now, this tool help my school project a lot! Thank you for your help, sir