Hi,

On Sun, 7 May 2023 08:34:29 +0800 (CST)
张小平 <13295564...@163.com> wrote:

> When i use Text or Label to show  this :
> [
> [1,"PAGE",{"id":"w"}],
> [2,"Text",{"caption":"This is first GUI Page,totally different form
> HTML."}] ]
>
>
> It shows this:
> {1 PAGE {{'id': 'w'}}} {2 Text {{'caption': 'This is first GUI Page,
> totally different form HTML.'}}}
>

you mean if you pass the list directly to the Label's text option?
In this case, the "magic" of tkinter apparently converts the Python list
into a proper Tcl list which is what you see here.
If you want the Python list to be displayed as label text, you need to
enclose it in quotation marks, as in

s = '''[
[1,"PAGE",{"id":"w"}],
[2,"Text",{"caption":"This is first GUI Page,totally different form
HTML."}] ]'''
Label(parent, text=s, justify='left')

Have a nice day,

Michael
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to