In this article, we will create a new function which will search for the currency pair in the tkinter display panel then highlight that currency pair with green background.
First we will create the button which will call the find statement function.
action_find = tk.Button(buttonFrame, text="Find", state=DISABLED, command=find_statement) # button used to highlight the currency pair action_find.pack(side=LEFT)
Next we will create the function.
def find_statement(): # highlight the currency pair countVar = StringVar() # use to hold the character count text_widget.tag_remove("search", "1.0", "end") # cleared the hightlighted currency pair # highlight the background of the searched currency pair pos = text_widget.search(based.get(), "1.0", stopindex="end", count=countVar) text_widget.tag_configure("search", background="green") end_pos = float(pos) + float(0.96) text_widget.tag_add("search", pos, str(end_pos)) pos = float(pos) + 2.0 text_widget.see(str(pos))
The above function will search for the currency symbol which matches the one selected from the currency combo box, then highlight that btc/currency pair.
BTC vs USD exchange rate
from Planet Python
via read more
No comments:
Post a Comment