#πŸ”’ Text effects + Sound

20 messages Β· Page 1 of 1 (latest)

serene vault
#
import winsound
print ("The Great Timer")
print("Type in the minutes first than the seconds in float form")

timer_amount_mins = float(input("How long do you want your timer to last in minutes? "))
timer_amount_secs = int(input("How much seconds do you want to add "))
timer_length = int(input("How many beeps do you want? "))

timer_amount_mins *=60
timer_amount =  timer_amount_mins + timer_amount_secs
timer_amount = int(timer_amount)

while timer_amount > 0:
    print(" ",timer_amount, end = '\r')
    timer_amount -= 1
    time.sleep(1)
   

if timer_amount == 0 :
    for i in range(timer_length):
        print("TIMER UP")
        winsound.Beep(2000, 200)
        winsound.Beep(1000, 200)
        winsound.Beep(500, 200)
        time.sleep(0.2)

I want the original text to have italics or bold for effects and is there any other way to produce a nicer sound

fluid tideBOT
#

Hey @serene vault!

Please edit your message to use a code block

Add a py after the three backticks.

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

This will result in the following:

print('Hello, world!')```
fluid tideBOT
#

@serene vault

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.

serene vault
#

Its not urgent

#

Just a qol change

cinder acorn
serene vault
#

Oh ty

cinder acorn
#

So ESC [ 3 m turns on italics, ESC [ 1 m turns on bold, ESC [ 0 m returns to the default text.
ESC is the ANSI escape code (27) and the 3, 1, 0 should be adjusted according to the table there.
You can turn on multiple modes at once.
Not all terminals support everything, but if something's not supported it's usually just ignored so it's normally safe to send.

cinder acorn
# serene vault Oh ty

So code like:

esc = '\x1b'
italic = f'{esc}[3m'
default = f'{esc}[0m'
print(f'Here is some {italic}text in italic{default}.')
serene vault
#

Oh ty this makes sense

#

I can use this now

serene vault
#

Its finished!!!

#

Its very simple and just gets you by

#

but I made it so im proud

#

I try to use as little ai as possible but I didnt know how to utilise the time module

slim holly
#

As long as you aren't having AI generate code for you, and are double checking what it tells you, small usage of it isn't the end of the world.

#

There is a small oddity in your code, though:

while timer_amount > 0:
    . . .

if timer_amount == 0:

In the current code, timer_amount must be an integer, so if that loop exits, timer_amount must be 0, so if timer_amount == 0: will always be true. That if also introduces a potential future bug where timer_amount skips 0 because you did something like decrement by more than 1, and the alarm never goes off.

fluid tideBOT
#
Python help channel closed for inactivity

This help channel has been closed. 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.