''' 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()
Isn't it about time forums rewarded their contributors?
Contribute to this discussion and earn rewards points that can be cashed out for dollars.
i am trying to create a library management system which is supposed to be used to store/keep infp for the library and the library members( book title, author, name and picture for borrower and other stuffs). The app has 6 buttons, delete, save, add,previsous,next, and upload( for upload ...
Im trying to bind my custom vertical scrollbar to datagridview is this possible.. Please help Thnak you..
I have two tables, I will call them first-half and second-half (of the year)
Table: first id jan feb mar apr ----------------------- 2 80 90 70 60 3 50 40 60 30 Table: second id jan feb mar apr ----------------------- 2 50 70 60 90 3 80 60 50 ...