#🔒 guizero Changing text

28 messages · Page 1 of 1 (latest)

velvet magnet
#

The program works fine I just need to know how to make the text change depending on the slider's temp range.

onyx patrolBOT
#

@velvet magnet

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

rocky badger
#

!code

onyx patrolBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

rocky badger
#

Can you put the code into a code block please?

velvet magnet
#

Yea one sec

#

Do I just put ! code after the code in the image?

rocky badger
#

No

#

Before the code write ```python

#

After ```

limpid basin
#

I would recommend you to learn OOP as that gives a good idea on how these packages work and you will be able to use most packages just by looking at the docs without tutorial.

velvet magnet
velvet magnet
onyx patrolBOT
#

Hey @velvet magnet!

It looks like you are trying to paste code into this channel.

You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.

Furthermore, it looks like you pasted Python code without syntax highlighting. Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
velvet magnet
#

def update_text(slide_value):

    temp = int(slide_value)

    if temp == 0:
        status.text_color = 'black'
        status.text = 'Engine Off'
        waf.color = 'black'

    elif 1 < temp < 194:
        status.text_color = 'blue'
        status.text = 'Engine Warming/Cooling'
        waf.color = 'blue'

    elif 195 < temp < 220:
        status.text_color = 'green'
        status.text = 'Engine Temp Normal'
        waf.color = 'green'

    elif 221 < temp < 300:
        status.text_color = 'red'
        status.text = 'Engine Overheating'
        waf.color = 'red'

app = App(title="Coolant Temperature", width=300, height=250, bg="pink")
Text(app, height=1)
slide = Slider(app, start=0, end=300, horizontal=False, width=20, height=130, align='left',command=update_text)
waf = Waffle(app, height=1, width=1, dim=50, dotty=True,color='black', pad=75)
status = Text(app, text='Engine Off', size=12, font="Helvtica", align='bottom', width='fill')

app.display()```
limpid basin
#

That's literally the exact same code that I gave you, no changes at all

velvet magnet
#

I understand that but the text was supposed to change

#

So I tried other things before asking best believe

limpid basin
#

what did you try that didn't work

velvet magnet
velvet magnet
limpid basin
limpid basin
velvet magnet
#

Ok well sorry, thanks for your help anyways

onyx patrolBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.