def __init__(self, master, title, width, body_background="white", background="#f0f0f0", foreground="#333333", selected_background="#1ba1e2", selected_foreground="white", active_foreground="#0067cb", cursor="hand1"): Frame.__init__(self, master, background="white") self._title = title self._background = background self._foreground = foreground self._active_foreground = active_foreground self._selected_foreground = selected_foreground self._selected_background = selected_background self._cursor = cursor self._right_arrow_icon = BitmapImage( data=base64.b64decode(Chord.RIGHT_ARROW_ICON)) self._down_arrow_icon = BitmapImage( data=base64.b64decode(Chord.DOWN_ARROW_ICON)) self._caption = Frame(self, width=width, background=background, padx=2) self._caption.pack(fill=X, pady=(0, 2)) self._caption.pack_propagate(False) self._icon_label = Label(self._caption, image=self._right_arrow_icon, background=background) self._icon_label.pack(side=LEFT) self._title_label = Label(self._caption, text=title, bg=background, fg=foreground) self._title_label.pack(side=LEFT, padx=4, fill=X) self._caption.configure(height=self._title_label.winfo_reqheight()) self.body = Frame(self, background=body_background) self._body_height = None self._is_opened = False self._is_animating = False self._caption.bind('<Button-1>', self._on_click) self._title_label.bind('<Button-1>', self._on_click) self._icon_label.bind('<Button-1>', self._on_click) self._caption.bind('<Enter>', self._on_enter) self._caption.bind('<Leave>', self._on_leave)
def __init__(self, master, size=22, **kw): image = Metro_Checkbutton.image[size] if isinstance(image, basestring): Metro_Checkbutton.image[size] = image = BitmapImage( data=base64.b64decode(image)) selectimage = Metro_Checkbutton.selectimage[size] if isinstance(selectimage, basestring): Metro_Checkbutton.selectimage[size] = selectimage = BitmapImage( data=base64.b64decode(selectimage)) Checkbutton.__init__(self, master, indicatoron=0, selectimage=selectimage, image=image, highlightthickness=0, **kw)
def __init__(self, parent=None): Frame.__init__(self, parent) self.pack(side=BOTTOM, anchor=S) # These must go AFTER root = Tk() self.bitmap_begin = BitmapImage(data=DATA_BITMAP_BEGIN) self.bitmap_end = BitmapImage(data=DATA_BITMAP_END) self.bitmap_stop = BitmapImage(data=DATA_BITMAP_STOP) self.bitmap_play = BitmapImage(data=DATA_BITMAP_PLAY) self.bitmap_stepback = BitmapImage(data=DATA_BITMAP_STEPBACK) self.bitmap_stepfd = BitmapImage(data=DATA_BITMAP_STEPFD) # Depcrecated: we no longer set up the COMMANDs here. # self.btn_begin = Button(self, image=self.bitmap_begin, # command = self.onBegin) self.btn_begin = Button(self, image=self.bitmap_begin) self.btn_end = Button(self, image=self.bitmap_end) self.btn_stop = Button(self, image=self.bitmap_stop) self.btn_play = Button(self, image=self.bitmap_play) self.btn_stepback = Button(self, image=self.bitmap_stepback) self.btn_stepfd = Button(self, image=self.bitmap_stepfd) self.btn_begin.pack(side=LEFT) self.btn_stepback.pack(side=LEFT) self.btn_stop.pack(side=LEFT) self.btn_play.pack(side=LEFT) self.btn_stepfd.pack(side=LEFT) self.btn_end.pack(side=LEFT) self.playing = 0 # Set to 1 when user presses play, 0 on stop
def __init__(self, master, title, width, body_background="white", background="#f0f0f0", foreground="#333333", selected_background="#1ba1e2", selected_foreground="white", active_foreground="#0067cb", cursor="hand1"): Frame.__init__(self, master, background="white") self._title = title self._background = background self._foreground = foreground self._active_foreground = active_foreground self._selected_foreground = selected_foreground self._selected_background = selected_background self._cursor = cursor self._right_arrow_icon = BitmapImage(data=base64.b64decode(Chord.RIGHT_ARROW_ICON)) self._down_arrow_icon = BitmapImage(data=base64.b64decode(Chord.DOWN_ARROW_ICON)) self._caption = Frame(self, width =width, background=background, padx=2) self._caption.pack(fill=X, pady=(0,2)) self._caption.pack_propagate(False) self._icon_label = Label(self._caption, image=self._right_arrow_icon, background=background) self._icon_label.pack(side=LEFT) self._title_label = Label(self._caption, text=title, bg = background, fg=foreground) self._title_label.pack(side=LEFT, padx=4, fill=X) self._caption.configure(height= self._title_label.winfo_reqheight()) self.body = Frame(self, background=body_background) self._body_height = None self._is_opened = False self._is_animating = False self._caption.bind('<Button-1>', self._on_click) self._title_label.bind('<Button-1>', self._on_click) self._icon_label.bind('<Button-1>', self._on_click) self._caption.bind('<Enter>', self._on_enter) self._caption.bind('<Leave>', self._on_leave)
def miniEditImages(): "Create and return images for MiniEdit." # Image data. Git will be unhappy. However, the alternative # is to keep track of separate binary files, which is also # unappealing. return { 'Select': BitmapImage( file='/usr/include/X11/bitmaps/left_ptr' ), 'Host': PhotoImage( data=r""" R0lGODlhIAAYAPcAMf//////zP//mf//Zv//M///AP/M///MzP/M mf/MZv/MM//MAP+Z//+ZzP+Zmf+ZZv+ZM/+ZAP9m//9mzP9mmf9m Zv9mM/9mAP8z//8zzP8zmf8zZv8zM/8zAP8A//8AzP8Amf8AZv8A M/8AAMz//8z/zMz/mcz/Zsz/M8z/AMzM/8zMzMzMmczMZszMM8zM AMyZ/8yZzMyZmcyZZsyZM8yZAMxm/8xmzMxmmcxmZsxmM8xmAMwz /8wzzMwzmcwzZswzM8wzAMwA/8wAzMwAmcwAZswAM8wAAJn//5n/ zJn/mZn/Zpn/M5n/AJnM/5nMzJnMmZnMZpnMM5nMAJmZ/5mZzJmZ mZmZZpmZM5mZAJlm/5lmzJlmmZlmZplmM5lmAJkz/5kzzJkzmZkz ZpkzM5kzAJkA/5kAzJkAmZkAZpkAM5kAAGb//2b/zGb/mWb/Zmb/ M2b/AGbM/2bMzGbMmWbMZmbMM2bMAGaZ/2aZzGaZmWaZZmaZM2aZ AGZm/2ZmzGZmmWZmZmZmM2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA /2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/ZjP/MzP/ADPM/zPM zDPMmTPMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNm mTNmZjNmMzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMAzDMAmTMA ZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/AADM/wDMzADMmQDMZgDM MwDMAACZ/wCZzACZmQCZZgCZMwCZAABm/wBmzABmmQBmZgBmMwBm AAAz/wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAM+4AAN0A ALsAAKoAAIgAAHcAAFUAAEQAACIAABEAAADuAADdAAC7AACqAACI AAB3AAB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ZZmaZM2aZ AGZm/2ZmzGZmmWZmZmZmM2ZmAGYz/2YzzGYzmWYzZmYzM2YzAGYA /2YAzGYAmWYAZmYAM2YAADP//zP/zDP/mTP/ZjP/MzP/ADPM/zPM zDPMmTPMZjPMMzPMADOZ/zOZzDOZmTOZZjOZMzOZADNm/zNmzDNm mTNmZjNmMzNmADMz/zMzzDMzmTMzZjMzMzMzADMA/zMAzDMAmTMA ZjMAMzMAAAD//wD/zAD/mQD/ZgD/MwD/AADM/wDMzADMmQDMZgDM MwDMAACZ/wCZzACZmQCZZgCZMwCZAABm/wBmzABmmQBmZgBmMwBm AAAz/wAzzAAzmQAzZgAzMwAzAAAA/wAAzAAAmQAAZgAAM+4AAN0A ALsAAKoAAIgAAHcAAFUAAEQAACIAABEAAADuAADdAAC7AACqAACI AAB3AABVAABEAAAiAAARAAAA7gAA3QAAuwAAqgAAiAAAdwAAVQAA RAAAIgAAEe7u7t3d3bu7u6qqqoiIiHd3d1VVVURERCIiIhEREQAA ACH5BAEAAAAALAAAAAAWABYAAAhIAAEIHEiwoEGBrhIeXEgwoUKG Cx0+hGhQoiuKBy1irChxY0GNHgeCDAlgZEiTHlFuVImRJUWXEGEy lBmxI8mSNknm1Dnx5sCAADs= """ ) }
def miniEditImages(): "Create and return images for MiniEdit." # Image data. Git will be unhappy. However, the alternative # is to keep track of separate binary files, which is also # unappealing. return { 'Select': BitmapImage( file='/usr/include/X11/bitmaps/left_ptr' ), 'Switch' : PhotoImage( data=r""" R0lGODlhOgArAMIEAB8aFwB7tQCb343L8P///////////////yH+GlNvZnR3YXJlOiBNaWNyb3NvZnQgT2ZmaWNlACwAAAAAOgArAAAD/ki63P4wykmrvTjr3YYfQigKH7d5Y6qmnjmBayyHg8vAAqDPaUTbowaA13OIahqcyEgEQEbIi7LIGA1FzsaSQK0QfbnH10sMa83VsqX53HLL7sgUTudR5s367F7PEq4CYDJRcngqfgshiAqAMwF3AYdWTCERjSoBjy+ZVItvMg6XIZmaEgOkSmJwlKO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AAAALAAAAAAWABYAAAhIAAEIHEiwoEGBrhIeXEgwoUKG Cx0+hGhQoiuKBy1irChxY0GNHgeCDAlgZEiTHlFuVImRJUWXEGEy lBmxI8mSNknm1Dnx5sCAADs= """ ) }
class Chord(Frame): RIGHT_ARROW_ICON = 'I2RlZmluZSBpbWFnZV93aWR0aCAxNwojZGVmaW5lIGltYWdlX2hlaWdodCAxNwpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLAoweDYwLDB4MDAsMHgwMCwweGUwLDB4MDAsMHgwMCwweGUwLDB4MDMsMHgwMCwweGUwLDB4MGYsMHgwMCwweGUwLDB4MDMsMHgwMCwKMHhlMCwweDAxLDB4MDAsMHg2MCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsCjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwCn07' DOWN_ARROW_ICON = 'I2RlZmluZSBpbWFnZV93aWR0aCAxNwojZGVmaW5lIGltYWdlX2hlaWdodCAxNwpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLAoweDAwLDB4MDAsMHgwMCwweGUwLDB4MGYsMHgwMCwweGUwLDB4MGYsMHgwMCwweGMwLDB4MDcsMHgwMCwweGMwLDB4MDMsMHgwMCwKMHg4MCwweDAzLDB4MDAsMHgwMCwweDAxLDB4MDAsMHgwMCwweDAxLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsCjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwCn07' def __init__(self, master, title, width, body_background="white", background="#f0f0f0", foreground="#333333", selected_background="#1ba1e2", selected_foreground="white", active_foreground="#0067cb", cursor="hand1"): Frame.__init__(self, master, background="white") self._title = title self._background = background self._foreground = foreground self._active_foreground = active_foreground self._selected_foreground = selected_foreground self._selected_background = selected_background self._cursor = cursor self._right_arrow_icon = BitmapImage( data=base64.b64decode(Chord.RIGHT_ARROW_ICON)) self._down_arrow_icon = BitmapImage( data=base64.b64decode(Chord.DOWN_ARROW_ICON)) self._caption = Frame(self, width=width, background=background, padx=2) self._caption.pack(fill=X, pady=(0, 2)) self._caption.pack_propagate(False) self._icon_label = Label(self._caption, image=self._right_arrow_icon, background=background) self._icon_label.pack(side=LEFT) self._title_label = Label(self._caption, text=title, bg=background, fg=foreground) self._title_label.pack(side=LEFT, padx=4, fill=X) self._caption.configure(height=self._title_label.winfo_reqheight()) self.body = Frame(self, background=body_background) self._body_height = None self._is_opened = False self._is_animating = False self._caption.bind('<Button-1>', self._on_click) self._title_label.bind('<Button-1>', self._on_click) self._icon_label.bind('<Button-1>', self._on_click) self._caption.bind('<Enter>', self._on_enter) self._caption.bind('<Leave>', self._on_leave) @property def title(self): return self._title @title.setter def title(self, text): self._title = text self._title_label.configure(text=text) def _on_enter(self, event): if not self._is_opened: self._down_arrow_icon.configure(foreground=self._active_foreground) self._right_arrow_icon.configure( foreground=self._active_foreground) self.config(cursor=self._cursor) def _on_leave(self, event): if not self._is_opened: self._down_arrow_icon.configure(foreground=self._foreground) self._right_arrow_icon.configure(foreground=self._foreground) self.config(cursor="arrow") def _on_click(self, event): if self._is_animating: return self.toggle() def open(self): if self._is_animating: return if not self._is_opened: self._open() def _open(self): self.body.pack() self.body.pack_propagate(False) self._icon_label.configure(image=self._down_arrow_icon, background=self._selected_background) self._title_label.configure(foreground=self._selected_foreground, background=self._selected_background) self._caption.configure(background=self._selected_background) self._down_arrow_icon.configure(foreground=self._selected_foreground) if self._body_height is None: self._body_height = self.body.winfo_reqheight() end_value = self._body_height self.body.configure(width=self.winfo_width()) self._is_opened = True self._is_animating = True animation = Animation(self, ticks=16, interval_time=0.01, start_value=0, end_value=end_value, config_function=lambda height: self.body. configure(height=int(height)), callback=self._on_finnish_animation) animation.start_animation() def _on_finnish_animation(self): self._is_animating = False if not self._is_opened: self.body.pack_forget() def close(self): if self._is_animating: return if self._is_opened: self._close() def _close(self): self._icon_label.configure(image=self._right_arrow_icon, background=self._background) self._title_label.configure(foreground=self._foreground, background=self._background) self._caption.configure(background=self._background) self._right_arrow_icon.configure(foreground=self._foreground) start_value = self.body.winfo_height() self._is_opened = False self._is_animating = True animation = Animation(self, ticks=16, interval_time=0.01, start_value=start_value, end_value=0, config_function=lambda height: self.body. configure(height=int(height)), callback=self._on_finnish_animation) animation.start_animation() def toggle(self): if self._is_opened: self._close() else: self._open()
class Chord(Frame): RIGHT_ARROW_ICON = 'I2RlZmluZSBpbWFnZV93aWR0aCAxNwojZGVmaW5lIGltYWdlX2hlaWdodCAxNwpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLAoweDYwLDB4MDAsMHgwMCwweGUwLDB4MDAsMHgwMCwweGUwLDB4MDMsMHgwMCwweGUwLDB4MGYsMHgwMCwweGUwLDB4MDMsMHgwMCwKMHhlMCwweDAxLDB4MDAsMHg2MCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsCjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwCn07' DOWN_ARROW_ICON = 'I2RlZmluZSBpbWFnZV93aWR0aCAxNwojZGVmaW5lIGltYWdlX2hlaWdodCAxNwpzdGF0aWMgY2hhciBpbWFnZV9iaXRzW10gPSB7CjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLAoweDAwLDB4MDAsMHgwMCwweGUwLDB4MGYsMHgwMCwweGUwLDB4MGYsMHgwMCwweGMwLDB4MDcsMHgwMCwweGMwLDB4MDMsMHgwMCwKMHg4MCwweDAzLDB4MDAsMHgwMCwweDAxLDB4MDAsMHgwMCwweDAxLDB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwLDB4MDAsCjB4MDAsMHgwMCwweDAwLDB4MDAsMHgwMCwweDAwCn07' def __init__(self, master, title, width, body_background="white", background="#f0f0f0", foreground="#333333", selected_background="#1ba1e2", selected_foreground="white", active_foreground="#0067cb", cursor="hand1"): Frame.__init__(self, master, background="white") self._title = title self._background = background self._foreground = foreground self._active_foreground = active_foreground self._selected_foreground = selected_foreground self._selected_background = selected_background self._cursor = cursor self._right_arrow_icon = BitmapImage(data=base64.b64decode(Chord.RIGHT_ARROW_ICON)) self._down_arrow_icon = BitmapImage(data=base64.b64decode(Chord.DOWN_ARROW_ICON)) self._caption = Frame(self, width =width, background=background, padx=2) self._caption.pack(fill=X, pady=(0,2)) self._caption.pack_propagate(False) self._icon_label = Label(self._caption, image=self._right_arrow_icon, background=background) self._icon_label.pack(side=LEFT) self._title_label = Label(self._caption, text=title, bg = background, fg=foreground) self._title_label.pack(side=LEFT, padx=4, fill=X) self._caption.configure(height= self._title_label.winfo_reqheight()) self.body = Frame(self, background=body_background) self._body_height = None self._is_opened = False self._is_animating = False self._caption.bind('<Button-1>', self._on_click) self._title_label.bind('<Button-1>', self._on_click) self._icon_label.bind('<Button-1>', self._on_click) self._caption.bind('<Enter>', self._on_enter) self._caption.bind('<Leave>', self._on_leave) @property def title(self): return self._title @title.setter def title(self, text): self._title = text self._title_label.configure(text=text) def _on_enter(self, event): if not self._is_opened: self._down_arrow_icon.configure(foreground=self._active_foreground) self._right_arrow_icon.configure(foreground=self._active_foreground) self.config(cursor=self._cursor) def _on_leave(self, event): if not self._is_opened: self._down_arrow_icon.configure(foreground=self._foreground) self._right_arrow_icon.configure(foreground=self._foreground) self.config(cursor="arrow") def _on_click(self, event): if self._is_animating: return self.toggle() def open(self): if self._is_animating: return if not self._is_opened: self._open() def _open(self): self.body.pack() self.body.pack_propagate(False) self._icon_label.configure(image=self._down_arrow_icon, background = self._selected_background) self._title_label.configure(foreground= self._selected_foreground, background = self._selected_background) self._caption.configure(background = self._selected_background) self._down_arrow_icon.configure(foreground=self._selected_foreground) if self._body_height is None: self._body_height= self.body.winfo_reqheight() end_value = self._body_height self.body.configure(width=self.winfo_width()) self._is_opened = True self._is_animating = True animation = Animation( self, ticks=16, interval_time=0.01, start_value=0, end_value=end_value, config_function=lambda height: self.body.configure(height=int(height)), callback=self._on_finnish_animation) animation.start_animation() def _on_finnish_animation(self): self._is_animating = False if not self._is_opened: self.body.pack_forget() def close(self): if self._is_animating: return if self._is_opened: self._close() def _close(self): self._icon_label.configure(image=self._right_arrow_icon, background = self._background) self._title_label.configure(foreground= self._foreground, background = self._background) self._caption.configure(background = self._background) self._right_arrow_icon.configure(foreground=self._foreground) start_value = self.body.winfo_height() self._is_opened = False self._is_animating = True animation = Animation( self, ticks=16, interval_time=0.01, start_value=start_value, end_value=0, config_function=lambda height: self.body.configure(height=int(height)), callback=self._on_finnish_animation) animation.start_animation() def toggle(self): if self._is_opened: self._close() else: self._open()