''' tk_button_image_toggle.py using itertools.cycle() to create a Tkinter ToogleUpDownImageButton tested with Python27 by vegaseat 01aug2014 ''' import itertools as it try: # Python27 import Tkinter as tk except ImportError: # Python3+ import tkinter as tk class ToogleUpDownImageButton(tk.Tk): def __init__(self): tk.Tk.__init__(self) # images are of an up and down button # pick GIF images you have in the working directory or give full path self.image_up = tk.PhotoImage(file='btn_up.gif') self.image_down = tk.PhotoImage(file='btn_down.gif') self.images = it.cycle([self.image_down, self.image_up]) self.button = tk.Button(self, image=self.image_up, command=self.toggle) self.button.pack() def toggle(self): """ toggle between up and down button images """ self.button['image'] = next(self.images) def main(): app = ToogleUpDownImageButton() app.mainloop() main()
Are you able to help answer this sponsored question?
Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...
there are five tables (personTb, addressTb,churchTb) each holds data pertinent to an individual; (personAddress,personChurch) each hold the primary key for the person table and corresponding table IE personAddress holds primary key for addressTb.
both snippets work, my question is; Is my join correctly formatted?
select concat(personTb.p_fName,' ',personTb.p_mName,'. ',personTb.p_lName) ...
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others