#!/usr/bin/python # -*- coding: utf-8 -*- # """ Nome: TkCustomFrame.py Autor: Alessandro dos Santos Ferreira ( santosferreira.alessandro@gmail.com ) Descricão: TODO. """ import sys if sys.version_info[0] < 3: import Tkinter as Tk else: import tkinter as Tk from TkUtils import Utils from util.X11Colors import Colors class CustomGrid(Tk.Frame): parent = None v = None def __init__(self, parent, width = 0, height = 0, bg='white'): self.parent = parent self.v = Tk.IntVar() Tk.Frame.__init__(self, self.parent, width=width, height=height, bg=bg) def add_cell_label(self, text, row, column, width=0, height=0, bg='white', fg="black"): Tk.Label(self, text=text, width=width, height=height, bg=bg, fg=fg, padx=4, pady=4).grid(row=row, column=column) def add_cell_button_color(self, text, row, column, width=0, height=0, bg='white', fg="black", command=None, command_args=None): bg_color = Colors.get_color_hex(bg) bt = Tk.Button(self, text=text, width=width, height=height, bg=bg_color, fg=fg, padx=0, pady=0, cursor="hand1", command=lambda *_: command(command_args)) bt.grid(row=row, column=column) def add_cell_radio_button(self, text, value, row, column, width=0, height=0, bg='white', fg="black", selected=False, command=None, command_args=None): radio = Tk.Radiobutton(self, text=text, variable=self.v, value=value, width=width, height=height, bg=bg, fg=fg, padx=4, pady=4, indicatoron=1, anchor=Tk.W, command=lambda *_: command(command_args), activebackground='#404040', highlightbackground='white') radio.grid(row=row, column=column) if(selected == True): radio.select()