1

I have raspi 3, and working on "Getting started with GUIs". I am currently on this page (https://projects.raspberrypi.org/en/projects/getting-started-with-guis/11) and having trouble at the line where it says "size = 40." My IDE doesnt seem to recognize this line, which I mean the color of "40" doesnt change on my IDE. Matter of fact it shows an error after I press enter. I have installed and updated guizero and tkinter. Does anyone spot a problem and any solutions? Thanks.

Here below is the code btw.

from guizero import App, Text, TextBox, PushButton, Slider, Picture

def say_my_name():
    welcome_message.value = my_name.value

def change_text_size(slider_value):
    welcome_message.size = slider_value

app = App(title="Hello world")

welcome_message = Text(app, text="Welcome to my app", size=40, font="Times new roman", color="lightblue")
my_name = TextBox(app, width=30)
update_text = PushButton(app, command=say_my_name, text="Display my name")
text_size = Slider(app, command=change_text_size, start=10, end=80)
my_cat = Picture(app, image="cat.gif")

app.display()
  • Matter of fact it shows an error after I press enter. Please add the full error message to your question. – Dirk Sep 21 '18 at 23:06
  • Hi Dirk, thanks for the comment. Here is what I get. – Nozomu Harada Sep 22 '18 at 9:35
  • Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> welcome_message = Text(app, text="Welcome to my app", size=40, font="Times new roman", color="lightblue") File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/guizero/Text.py", line 12, in init tk = Label(master.tk, text=text, fg=utils.convert_color(color), bg=utils.convert_color(bg), font=(font, size)) – Nozomu Harada Sep 22 '18 at 9:37
  • File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 2763, in init Widget.__init__(self, master, 'label', cnf, kw) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 2296, in init (widgetName, self._w) + extra + self._options(cnf)) _tkinter.TclError: can't invoke "label" command: application has been destroyed – Nozomu Harada Sep 22 '18 at 9:37
  • Sorry I couldn't post it all at once, so I had to split it into 2. – Nozomu Harada Sep 22 '18 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.