Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Tkinter flashing text help
Post Body

I am new to using Python and Tkinter. I am editing some code I found online that is a program that counts down to a set date. I have already made some simple changes to make it display 0:00:00 when the time hits 0 instead of going negative. But I would like to make the text flash when it hits 0. I assuming this could be done by changing the text color between green2(Original text color) and gray9(Background color). But, I have very little knowledge of Tkinter and Python and wasn't able to find any information online.

\#!/usr/bin/python

from tkinter import \*
from tkinter import ttk
from tkinter import font
import time
import datetime

global endTime

def quit(\*args):
root.destroy()
def show\_time():
    \# Get the time remaining until the event
    remainder = endTime - [datetime.datetime.now](https://datetime.datetime.now)()
    \# remove the microseconds part
    remainder = remainder - datetime.timedelta(microseconds=remainder.microseconds)
    \# Show the time left
    if endTim > [datetime.datetime.now](https://datetime.datetime.now)():
        txt.set(remainder)
    elif endTime < [datetime.datetime.now](https://datetime.datetime.now)():
        txt.set("0:00:00")
    \# Trigger the countdown after 1000ms
    root.after(1000, show\_time)

\# Use tkinter lib for showing the clock
root = Tk()
root.attributes("-fullscreen", True)
root.configure(background='gray9')
root.bind("x", quit)
root.bind('<Escape'>, quit)
root.after(1000, show\_time)

\# Set the end date and time for the countdown
endTime = datetime.datetime(2019, 4, 25, 16, 0, 0)

fnt = font.Font(family='Helvetica', size=120, weight='bold')
txt = StringVar()
lbl = ttk.Label(root, textvariable=txt, font=fnt, foreground="green2", background="gray9")
lbl.place(relx=0.5, rely=0.5, anchor=CENTER)

root.mainloop()

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
29,462
Link Karma
26,709
Comment Karma
2,653
Profile updated: 1 week ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 years ago