Python ttk.Style() Examples
The following are 24
code examples of ttk.Style().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ttk
, or try the search function
.
Example #1
Source File: myNotebook.py From EDMarketConnector with GNU General Public License v2.0 | 7 votes |
def __init__(self, master=None, **kw): ttk.Notebook.__init__(self, master, **kw) style = ttk.Style() if platform=='darwin': if map(int, mac_ver()[0].split('.')) >= [10,10]: # Hack for tab appearance with 8.5 on Yosemite & El Capitan. For proper fix see # https://github.com/tcltk/tk/commit/55c4dfca9353bbd69bbcec5d63bf1c8dfb461e25 style.configure('TNotebook.Tab', padding=(12,10,12,2)) style.map('TNotebook.Tab', foreground=[('selected', '!background', 'systemWhite')]) self.grid(sticky=tk.NSEW) # Already padded apropriately elif platform == 'win32': style.configure('nb.TFrame', background=PAGEBG) style.configure('nb.TButton', background=PAGEBG) style.configure('nb.TCheckbutton', foreground=PAGEFG, background=PAGEBG) style.configure('nb.TMenubutton', foreground=PAGEFG, background=PAGEBG) style.configure('nb.TRadiobutton', foreground=PAGEFG, background=PAGEBG) self.grid(padx=10, pady=10, sticky=tk.NSEW) else: self.grid(padx=10, pady=10, sticky=tk.NSEW)
Example #2
Source File: closable_Tab_with_menu.py From PCWG with MIT License | 7 votes |
def createClosableTabStyle(self): style = ttk.Style() style.element_create("close", "image", "img_close", ("active", "pressed", "!disabled", "img_closepressed"), ("active", "!disabled", "img_closeactive"), border=8, sticky='') style.layout("ButtonNotebook", [("ButtonNotebook.client", {"sticky": "nswe"})]) style.layout("ButtonNotebook.Tab", [ ("ButtonNotebook.tab", {"sticky": "nswe", "children": [("ButtonNotebook.padding", {"side": "top", "sticky": "nswe", "children": [("ButtonNotebook.focus", {"side": "top", "sticky": "nswe", "children": [("ButtonNotebook.label", {"side": "left", "sticky": ''}), ("ButtonNotebook.close", {"side": "left", "sticky": ''})] })] })] })] ) return style
Example #3
Source File: gui.py From stochopy with MIT License | 7 votes |
def main(): """ Start StochOPy Viewer window. """ from sys import platform as _platform root = tk.Tk() root.resizable(0, 0) StochOGUI(root) s = ttk.Style() if _platform == "win32": s.theme_use("vista") elif _platform in [ "linux", "linux2" ]: s.theme_use("alt") elif _platform == "darwin": s.theme_use("aqua") root.mainloop()
Example #4
Source File: pcwg_tool_reborn.py From PCWG with MIT License | 6 votes |
def createClosableTabStyle(self): style = ttk.Style() style.element_create("close", "image", "img_close", ("active", "pressed", "!disabled", "img_closepressed"), ("active", "!disabled", "img_closeactive"), border=8, sticky='') style.layout("ButtonNotebook", [("ButtonNotebook.client", {"sticky": "nswe"})]) style.layout("ButtonNotebook.Tab", [ ("ButtonNotebook.tab", {"sticky": "nswe", "children": [("ButtonNotebook.padding", {"side": "top", "sticky": "nswe", "children": [("ButtonNotebook.focus", {"side": "top", "sticky": "nswe", "children": [("ButtonNotebook.label", {"side": "left", "sticky": ''}), ("ButtonNotebook.close", {"side": "left", "sticky": ''})] })] })] })] ) return style
Example #5
Source File: tkinter.py From peniot with MIT License | 6 votes |
def __init__(self, parent_window): Frame.__init__(self, parent_window) # Configure the window self.configure(background=window_background_color) # Create the header Header(self).grid(row=0, columnspan=4) s = ttk.Style() s.configure(".", font=("Arial", 15)) tab_control = ttk.Notebook(self) attack_tab = TabFrame(tab_control, ExportOptions.ATTACK) tab_control.add(attack_tab, text="Attack") attacksuite_tab = TabFrame(tab_control, ExportOptions.ATTACK_SUITE) tab_control.add(attacksuite_tab, text="Attack Suite") protocol_tab = TabFrame(tab_control, ExportOptions.PROTOCOL) tab_control.add(protocol_tab, text="Protocol") tab_control.grid(row=1, column=0, columnspan=4, rowspan=3, sticky=W + E + S + N) CustomButton(self, back_to_menu_label, lambda: change_frame(self, ExtensionPage(root)), 7, None, E, 1) self.grid()
Example #6
Source File: dateentry.py From tkcalendar with GNU General Public License v3.0 | 6 votes |
def _setup_style(self, event=None): """Style configuration to make the DateEntry look like a Combobbox.""" self.style.layout('DateEntry', self.style.layout('TCombobox')) self.update_idletasks() conf = self.style.configure('TCombobox') if conf: self.style.configure('DateEntry', **conf) maps = self.style.map('TCombobox') if maps: try: self.style.map('DateEntry', **maps) except tk.TclError: # temporary fix for issue #61 and https://bugs.python.org/issue38661 maps = MAPS.get(self.style.theme_use(), MAPS['default']) self.style.map('DateEntry', **maps) try: self.after_cancel(self._determine_downarrow_name_after_id) except ValueError: # nothing to cancel pass self._determine_downarrow_name_after_id = self.after(10, self._determine_downarrow_name)
Example #7
Source File: cheetah_update.py From cheetah-gui with GNU General Public License v3.0 | 6 votes |
def __init__(self, top=None): """This class configures and populates the toplevel window. top is the toplevel containing window.""" _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana1color)]) top.geometry("388x169+474+249") top.title("Cheetah Update") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") self.TButton1 = ttk.Button(top) self.TButton1.place(relx=0.23, rely=0.71, height=27, width=87) self.TButton1.configure(command=cheetah_update_support.check_updates) self.TButton1.configure(takefocus="") self.TButton1.configure(textvariable=cheetah_update_support.check_update) self.Message1 = Message(top) self.Message1.place(relx=0.05, rely=0.12, relheight=0.44, relwidth=0.87) self.Message1.configure(background="#d9d9d9") self.Message1.configure(foreground="#000000") self.Message1.configure(highlightbackground="#d9d9d9") self.Message1.configure(highlightcolor="black") self.Message1.configure(textvariable=cheetah_update_support.update_msg) self.Message1.configure(width=337) self.TButton2 = ttk.Button(top) self.TButton2.place(relx=0.57, rely=0.71, height=27, width=87) self.TButton2.configure(command=cheetah_update_support.exit_update) self.TButton2.configure(takefocus="") self.TButton2.configure(text='''Cancel''')
Example #8
Source File: myNotebook.py From EDMarketConnector with GNU General Public License v2.0 | 6 votes |
def __init__(self, master, variable, default=None, *values, **kw): if platform == 'darwin': variable.set(default) bg = kw.pop('background', PAGEBG) tk.OptionMenu.__init__(self, master, variable, *values, **kw) self['background'] = bg elif platform == 'win32': # OptionMenu derives from Menubutton at the Python level, so uses Menubutton's style ttk.OptionMenu.__init__(self, master, variable, default, *values, style='nb.TMenubutton', **kw) self['menu'].configure(background = PAGEBG) # Workaround for https://bugs.python.org/issue25684 for i in range(0, self['menu'].index('end')+1): self['menu'].entryconfig(i, variable=variable) else: ttk.OptionMenu.__init__(self, master, variable, default, *values, **kw) self['menu'].configure(background = ttk.Style().lookup('TMenu', 'background')) # Workaround for https://bugs.python.org/issue25684 for i in range(0, self['menu'].index('end')+1): self['menu'].entryconfig(i, variable=variable)
Example #9
Source File: settings.py From tixcraft_bot with Apache License 2.0 | 5 votes |
def main(): load_json() global root root = Tk() root.title(CONST_APP_VERSION) #style = ttk.Style(root) #style.theme_use('aqua') #root.configure(background='lightgray') # style configuration #style = Style(root) #style.configure('TLabel', background='lightgray', foreground='black') #style.configure('TFrame', background='lightgray') GUI = MainMenu(root) GUI_SIZE_WIDTH = 420 GUI_SIZE_HEIGHT = 370 GUI_SIZE_MACOS = str(GUI_SIZE_WIDTH) + 'x' + str(GUI_SIZE_HEIGHT) GUI_SIZE_WINDOWS=str(GUI_SIZE_WIDTH-60) + 'x' + str(GUI_SIZE_HEIGHT-20) GUI_SIZE =GUI_SIZE_MACOS import platform if platform.system() == 'Windows': GUI_SIZE =GUI_SIZE_WINDOWS root.geometry(GUI_SIZE) root.mainloop()
Example #10
Source File: menotexport-gui.py From Menotexport with GNU General Public License v3.0 | 5 votes |
def initUI(self): self.parent.title(self.title) self.style=Style() #Choose from default, clam, alt, classic self.style.theme_use('alt') self.pack(fill=tk.BOTH,expand=True) self.centerWindow()
Example #11
Source File: test_style.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def setUp(self): super(StyleTest, self).setUp() self.style = ttk.Style(self.root)
Example #12
Source File: tooltip.py From tkcalendar with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, **kwargs): """ Construct a Tooltip with parent master. Keyword Options --------------- ttk.Label options, alpha: float. Tooltip opacity between 0 and 1. """ tk.Toplevel.__init__(self, parent, padx=0, pady=0) self.transient(parent) self.overrideredirect(True) self.update_idletasks() self.attributes('-alpha', kwargs.pop('alpha', 0.8)) if platform == 'linux': self.attributes('-type', 'tooltip') if not Tooltip._initialized: # default tooltip style style = ttk.Style(self) style.configure('tooltip.TLabel', foreground='gray90', background='black', font='TkDefaultFont 9 bold') Tooltip._initialized = True # default options kw = {'compound': 'left', 'style': 'tooltip.TLabel', 'padding': 4} # update with given options kw.update(kwargs) self.label = ttk.Label(self, **kw) self.label.pack(fill='both') self.config = self.configure
Example #13
Source File: sqlite_bro.py From sqlite_bro with MIT License | 5 votes |
def create_style(self): """create a Notebook style with close button""" # from https://github.com/python-git/python/blob/master/Demo/tkinter/ # ttk/notebook_closebtn.py # himself from http://paste.tclers.tk/896 style = ttk.Style() style.element_create("close", "image", "img_close", ("active", "pressed", "!disabled", "img_closepressed"), ("active", "!disabled", "img_closeactive"), border=6, sticky='') style.layout("ButtonNotebook", [ ("ButtonNotebook.client", {"sticky": "nswe"})]) style.layout("ButtonNotebook.Tab", [ ("ButtonNotebook.tab", {"sticky": "nswe", "children": [("ButtonNotebook.padding", {"side": "top", "sticky": "nswe", "children": [("ButtonNotebook.focus", {"side": "top", "sticky": "nswe", "children": [("ButtonNotebook.label", {"side": "left", "sticky": ''}), ("ButtonNotebook.close", {"side": "left", "sticky": ''})] })] })] })] ) self.tk_win.bind_class("TNotebook", "<ButtonPress-1>", self.btn_press, True) self.tk_win.bind_class("TNotebook", "<ButtonRelease-1>", self.btn_release) self.tk_win.bind_class("TNotebook", "<B1-Motion>", self.btn_Movex) self.tk_win.bind_class("TNotebook", "<Double-1>", self.btn_presstwice)
Example #14
Source File: gui.py From content-downloader with MIT License | 5 votes |
def main(): """ main function """ s = ttk.Style() s.theme_use('clam') ents = makeform(root) root.mainloop()
Example #15
Source File: myNotebook.py From EDMarketConnector with GNU General Public License v2.0 | 5 votes |
def __init__(self, master=None, **kw): if platform in ['darwin', 'win32']: kw['foreground'] = kw.pop('foreground', PAGEFG) kw['background'] = kw.pop('background', PAGEBG) else: kw['foreground'] = kw.pop('foreground', ttk.Style().lookup('TLabel', 'foreground')) kw['background'] = kw.pop('background', ttk.Style().lookup('TLabel', 'background')) tk.Label.__init__(self, master, **kw) # Just use tk.Label on all platforms
Example #16
Source File: client_interface.py From BitMeshPOC with MIT License | 5 votes |
def initUI(self): self.parent.title("Bitmesh Client") self.style = Style() self.style.theme_use("default") self.pack(fill=BOTH, expand=1) # set up the grid on the frame. Feels a lot like # "GridBagLayout" from java.swing self.columnconfigure(1, weight=1) self.columnconfigure(3, pad=1) self.rowconfigure(3, weight=1) self.rowconfigure(5, pad=1) # establish text area with border of 1 that is "Sunken" self.log_text_area = Text(self, bd=1, relief=SUNKEN) self.log_text_area.insert(END,"BEGIN LOG\n---------") # Texts have to be in state normal to be modified. I am doing this # so the user doesn't edit the log self.log_text_area.config(state=DISABLED) self.log_text_area.grid(row=1, column=0, columnspan=2, rowspan=4, sticky=E+W+S+N) self.connect_button = Button(self, text="Connect to Server") # TODO: attempting to strech the button across the grid self.connect_button.grid(row=1, column=2, sticky=E+W+N) self.connect_button.bind("<Button-1>", self.connect_callback) self.request_text_area = Text(self, height=1, bd=1, relief=SUNKEN) self.request_text_area.grid(row=0 ,column=1, sticky=E+W) self.request_website_button = Button(self, text="Request Site") self.request_website_button.grid(row=0, column=0, columnspan=1, sticky=W+N) self.request_website_button.bind("<Button-1>", self.request_callback) # on connect_button left clicked
Example #17
Source File: test_style.py From oss-ftp with MIT License | 5 votes |
def setUp(self): super(StyleTest, self).setUp() self.style = ttk.Style(self.root)
Example #18
Source File: test_style.py From BinderFilter with MIT License | 5 votes |
def setUp(self): self.style = ttk.Style()
Example #19
Source File: userInterface.py From PcapXray with GNU General Public License v2.0 | 5 votes |
def __init__(self, base): # Base Frame Configuration self.base = base base.title("PcapXray") Label(base, text="PcapXray Tool - A LAN Network Analyzer") # Style Configuration style = ttk.Style() style.configure("BW.TLabel", foreground="black") style.configure("BW.TEntry", foreground="black") # 1st Frame - Initial Frame InitFrame = ttk.Frame(base, width=50, padding="10 10 10 10",relief= GROOVE) InitFrame.grid(column=10, row=10, sticky=(N, W, E, S)) InitFrame.columnconfigure(10, weight=1) InitFrame.rowconfigure(10, weight=1) # Pcap File Entry self.pcap_file = StringVar() self.filename = "" ttk.Label(InitFrame, text="Enter pcap file path: ",style="BW.TLabel").grid(column=0, row=0, sticky="W") self.filename_field = ttk.Entry(InitFrame, width=30, textvariable=self.pcap_file, style="BW.TEntry").grid(column=1, row=0, sticky="W, E") self.progressbar = ttk.Progressbar(InitFrame, orient="horizontal", length=200,value=0, maximum=200, mode="indeterminate") # Browse button #self.filename = StringVar() ttk.Button(InitFrame, text="Browse", command=self.browse_directory).grid(column=2, row=0, padx=10, pady=10,sticky="E") ttk.Button(InitFrame, text="Analyze!", command=self.pcap_analyse).grid(column=3, row=0, padx=10, pady=10,sticky="E") self.progressbar.grid(column=4, row=0, padx=10, pady=10, sticky="E") # Second Frame with Options SecondFrame = ttk.Frame(base, width=50, padding="10 10 10 10",relief= GROOVE) SecondFrame.grid(column=10, row=20, sticky=(N, W, E, S)) SecondFrame.columnconfigure(10, weight=1) SecondFrame.rowconfigure(10, weight=1) ttk.Label(SecondFrame, text="Options: ", style="BW.TLabel").grid(row=10,column=0,sticky="W") self.option = StringVar() self.options = {'All','HTTP','HTTPS','Tor','Malicious'} #self.option.set('Tor') ttk.OptionMenu(SecondFrame,self.option,"Select",*self.options).grid(row=10,column=1,sticky="W") self.zoom = [900,900] self.img = "" ttk.Button(SecondFrame, text="zoomIn", command=self.zoom_in).grid(row=10,column=10,padx=5,sticky="E") ttk.Button(SecondFrame, text="zoomOut", command=self.zoom_out).grid(row=10,column=11,sticky="E") # Third Frame with Results and Descriptioms self.ThirdFrame = ttk.Frame(base, width=100, height=100, padding="10 10 10 10",relief= GROOVE) description = """It is a tool aimed to simplyfy the network analysis and speed the process of analysing the network traffic.\nThis prototype aims to accomplish 4 important modules, \n 1. Web Traffic\n 2. Tor Traffic \n 3. Malicious Traffic \n 4. Device/Traffic Details\n\nPlease contact me @ spg349@nyu.edu for any bugs or problems ! """ self.label = ttk.Label(self.ThirdFrame, text="Description: \nPcapXray tools is an aid for Network Forensics or Any Network Analysis!\n"+description, style="BW.TLabel") self.label.grid(column=10, row=10,sticky="W") self.xscrollbar = Scrollbar(self.ThirdFrame, orient=HORIZONTAL) self.xscrollbar.grid(row=100, column=0, sticky=E + W) self.yscrollbar = Scrollbar(self.ThirdFrame, orient=VERTICAL) self.yscrollbar.grid(row=0, column=100, sticky=N + S) self.ThirdFrame.grid(column=10, row=30, sticky=(N, W, E, S)) self.ThirdFrame.columnconfigure(0, weight=1) self.ThirdFrame.rowconfigure(0, weight=1) self.name_servers = ""
Example #20
Source File: ttkHyperlinkLabel.py From EDMarketConnector with GNU General Public License v2.0 | 5 votes |
def __init__(self, master=None, **kw): self.url = 'url' in kw and kw.pop('url') or None self.popup_copy = kw.pop('popup_copy', False) self.underline = kw.pop('underline', None) # override ttk.Label's underline self.foreground = kw.get('foreground') or 'blue' self.disabledforeground = kw.pop('disabledforeground', ttk.Style().lookup('TLabel', 'foreground', ('disabled',))) # ttk.Label doesn't support disabledforeground option if platform == 'darwin': # Use tk.Label 'cos can't set ttk.Label background - http://www.tkdocs.com/tutorial/styles.html#whydifficult kw['background'] = kw.pop('background', 'systemDialogBackgroundActive') kw['anchor'] = kw.pop('anchor', tk.W) # like ttk.Label tk.Label.__init__(self, master, **kw) else: ttk.Label.__init__(self, master, **kw) self.bind('<Button-1>', self._click) self.menu = tk.Menu(None, tearoff=tk.FALSE) self.menu.add_command(label=_('Copy'), command = self.copy) # As in Copy and Paste self.bind(platform == 'darwin' and '<Button-2>' or '<Button-3>', self._contextmenu) self.bind('<Enter>', self._enter) self.bind('<Leave>', self._leave) # set up initial appearance self.configure(state = kw.get('state', tk.NORMAL), text = kw.get('text'), font = kw.get('font', ttk.Style().lookup('TLabel', 'font'))) # Change cursor and appearance depending on state and text
Example #21
Source File: cheetah_dictionary.py From cheetah-gui with GNU General Public License v3.0 | 4 votes |
def __init__(self, top=None): """This class configures and populates the toplevel window. top is the toplevel containing window.""" _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#d9d9d9' # X11 color: 'gray85' self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.', background=_bgcolor) self.style.configure('.', foreground=_fgcolor) self.style.configure('.', font="TkDefaultFont") self.style.map('.', background=[('selected', _compcolor), ('active', _ana2color)]) top.geometry("398x150+490+300") top.title("Cheetah Dictionary Setting") top.configure(background="#d9d9d9") top.configure(highlightbackground="#d9d9d9") top.configure(highlightcolor="black") top.resizable(0, 0) self.Label1 = Label(top) self.Label1.place(relx=0.05, rely=0.27, height=27, width=36) self.Label1.configure(background="#d9d9d9") self.Label1.configure(foreground="#000000") self.Label1.configure(text='''Path :''') self.Button1 = Button(top) self.Button1.place(relx=0.89, rely=0.27, height=24, width=24) self.Button1.configure(takefocus="") self.Button1.configure(text='''...''') self.Button1.configure(command=cheetah_dictionary_support.set_pwd_file) self.TButton2 = ttk.Button(top) self.TButton2.place(relx=0.21, rely=0.6, height=27, width=98) self.TButton2.configure(takefocus="") self.TButton2.configure(text='''Dereplicat''') self.TButton2.configure(command=cheetah_dictionary_support.dereplicat_pwd_file) self.TButton3 = ttk.Button(top) self.TButton3.place(relx=0.54, rely=0.6, height=27, width=98) self.TButton3.configure(takefocus="") self.TButton3.configure(text='''OK''') self.TButton3.configure(command=cheetah_dictionary_support.exit_dict_setting) self.TCombobox1 = ttk.Combobox(top) self.TCombobox1.place(relx=0.15, rely=0.27, relheight=0.18, relwidth=0.74) self.TCombobox1.configure(values=cheetah_dictionary_support.dict_list) self.TCombobox1.configure(textvariable=cheetah_dictionary_support.dict_path_var) self.TCombobox1.configure(takefocus="") # self.TCombobox1.set(cheetah_dictionary_support.dict_path)
Example #22
Source File: check_log_gui.py From nekros with BSD 3-Clause "New" or "Revised" License | 4 votes |
def __init__(self, top=None): '''This class configures and populates the toplevel window. top is the toplevel containing window.''' _bgcolor = '#d9d9d9' # X11 color: 'gray85' _fgcolor = '#000000' # X11 color: 'black' _compcolor = '#d9d9d9' # X11 color: 'gray85' _ana1color = '#d9d9d9' # X11 color: 'gray85' _ana2color = '#ececec' # Closest X11 color: 'gray92' font10 = "-family {Segoe UI} -size 14 -weight bold -slant " \ "roman -underline 0 -overstrike 0" self.style = ttk.Style() if sys.platform == "win32": self.style.theme_use('winnative') self.style.configure('.',background=_bgcolor) self.style.configure('.',foreground=_fgcolor) self.style.map('.',background= [('selected', _compcolor), ('active',_ana2color)]) top.geometry("600x450+413+160") icon_location = ImageTk.PhotoImage(file=os.path.join(prog_location,"img/lock.ico")) top.tk.call('wm', 'iconphoto', top._w, icon_location) top.resizable(0, 0) top.title("Check Encrypted Files Log Window") top.configure(background="#ff0000") self.Scrolledlistbox1 = ScrolledListBox(top) self.Scrolledlistbox1.place(relx=0.012, rely=0.111, relheight=0.878 , relwidth=0.968) self.Scrolledlistbox1.configure(background="white") self.Scrolledlistbox1.configure(disabledforeground="#a3a3a3") self.Scrolledlistbox1.configure(font="TkFixedFont") self.Scrolledlistbox1.configure(foreground="black") self.Scrolledlistbox1.configure(highlightbackground="#d9d9d9") self.Scrolledlistbox1.configure(highlightcolor="#d9d9d9") self.Scrolledlistbox1.configure(selectbackground="#c4c4c4") self.Scrolledlistbox1.configure(selectforeground="black") self.Label1 = tk.Label(top) self.Label1.place(relx=0.008, rely=0.011, height=41, width=584) self.Label1.configure(background="#ff0000") self.Label1.configure(disabledforeground="#a3a3a3") self.Label1.configure(font=font10) self.Label1.configure(foreground="#ffff79") self.Label1.configure(text='''These Are The Files Which Are Affected By This Ransomeware!!!''')
Example #23
Source File: test_dateentry.py From tkcalendar with GNU General Public License v3.0 | 4 votes |
def test_dateentry_get_set(self): widget = DateEntry(self.window, width=12, background='darkblue', locale='en_US', foreground='white', borderwidth=2, font='Arial 9', year=2019, month=7, day=3) widget.pack() self.window.update() keys = ['exportselection', 'invalidcommand', 'justify', 'show', 'cursor', 'calendar_cursor', 'style', 'state', 'takefocus', 'textvariable', 'validate', 'validatecommand', 'width', 'xscrollcommand'] keys.extend(widget._calendar.keys()) self.assertEqual(sorted(list(set(keys))), sorted(widget.keys())) self.assertEqual(widget["background"], 'darkblue') self.assertEqual(widget.cget("width"), 12) widget["borderwidth"] = 5 self.window.update() self.assertEqual(widget["borderwidth"], 5) widget.configure({'foreground': 'cyan', 'font': 'FreeMono 10', 'background': 'green'}, background="blue", borderwidth=4, font="Arial 20 bold", justify='center') self.window.update() self.assertEqual(widget["foreground"], "cyan") self.assertEqual(widget["background"], "blue") self.assertEqual(widget["borderwidth"], 4) self.assertEqual(widget["font"], "Arial 20 bold") self.assertEqual(widget["justify"], "center") widget.config(font="Arial 20 bold") self.window.update() self.assertEqual(widget["font"], "Arial 20 bold") widget.config(style="my.TEntry") self.window.update() self.assertEqual(widget["style"], "my.TEntry") style = ttk.Style(self.window) style.theme_use('clam') self.assertEqual(widget["locale"], "en_US") self.assertEqual(widget.get(), '7/3/19') widget.config(locale="fr_FR") self.window.update() self.assertEqual(widget["locale"], "fr_FR") self.assertEqual(widget.get(), '03/07/2019')
Example #24
Source File: theme.py From EDMarketConnector with GNU General Public License v2.0 | 4 votes |
def _colors(self, root, theme): style = ttk.Style() if platform == 'linux2': style.theme_use('clam') # Default dark theme colors if not config.get('dark_text'): config.set('dark_text', '#ff8000') # "Tangerine" in OSX color picker if not config.get('dark_highlight'): config.set('dark_highlight', 'white') if theme: # Dark (r, g, b) = root.winfo_rgb(config.get('dark_text')) self.current = { 'background' : 'grey4', # OSX inactive dark titlebar color 'foreground' : config.get('dark_text'), 'activebackground' : config.get('dark_text'), 'activeforeground' : 'grey4', 'disabledforeground' : '#%02x%02x%02x' % (r/384, g/384, b/384), 'highlight' : config.get('dark_highlight'), # Font only supports Latin 1 / Supplement / Extended, and a few General Punctuation and Mathematical Operators 'font' : (theme > 1 and not 0x250 < ord(_('Cmdr')[0]) < 0x3000 and tkFont.Font(family='Euro Caps', size=10, weight=tkFont.NORMAL) or 'TkDefaultFont'), } else: # (Mostly) system colors style = ttk.Style() self.current = { 'background' : (platform == 'darwin' and 'systemMovableModalBackground' or style.lookup('TLabel', 'background')), 'foreground' : style.lookup('TLabel', 'foreground'), 'activebackground' : (platform == 'win32' and 'SystemHighlight' or style.lookup('TLabel', 'background', ['active'])), 'activeforeground' : (platform == 'win32' and 'SystemHighlightText' or style.lookup('TLabel', 'foreground', ['active'])), 'disabledforeground' : style.lookup('TLabel', 'foreground', ['disabled']), 'highlight' : 'blue', 'font' : 'TkDefaultFont', } # Apply current theme to a widget and its children, and register it for future updates