Separates style
This commit is contained in:
@ -8,19 +8,19 @@ class Entry(GridFrame):
|
||||
def __init__(self, parent, *args, **kwargs):
|
||||
GridFrame.__init__(self, parent, *args, **kwargs)
|
||||
self.aLabel = ttk.Label(self, text='Initial:')
|
||||
self.a = ttk.Entry(self)
|
||||
self.a = ttk.Entry(self, style='EntryStyle.TEntry')
|
||||
|
||||
self.add(self.aLabel, 0, 0)
|
||||
self.add(self.a, 0, 1)
|
||||
|
||||
self.bLabel = ttk.Label(self, text='Final:')
|
||||
self.b = ttk.Entry(self)
|
||||
self.b = ttk.Entry(self, style='EntryStyle.TEntry')
|
||||
|
||||
self.add(self.bLabel, 1, 0)
|
||||
self.add(self.b, 1, 1)
|
||||
|
||||
self.cLabel = ttk.Label(self, text='Next:')
|
||||
self.c = ttk.Entry(self)
|
||||
self.c = ttk.Entry(self, style='EntryStyle.TEntry')
|
||||
|
||||
self.add(self.cLabel, 2, 0)
|
||||
self.add(self.c, 2, 1)
|
||||
|
||||
@ -13,6 +13,7 @@ from .status import Status, StatusFrame
|
||||
from .gridframe import GridFrame
|
||||
from .primary import Primary
|
||||
from .list import List
|
||||
from .style import configure_style
|
||||
|
||||
from .plot import plot_imbedded
|
||||
|
||||
@ -86,6 +87,8 @@ class GUI(object):
|
||||
self.app = MainApplication(self.root)
|
||||
self.app.grid(row=0, column=0, sticky=tk.N+tk.S+tk.E+tk.W)
|
||||
|
||||
configure_style(ttk.Style())
|
||||
|
||||
self.lastUpdated = time.time()
|
||||
self.updateInterval = updateInterval
|
||||
|
||||
|
||||
33
copycat/gui/style.py
Normal file
33
copycat/gui/style.py
Normal file
@ -0,0 +1,33 @@
|
||||
style_dict = dict(foreground='white',
|
||||
background='black')
|
||||
|
||||
map_options = dict(
|
||||
foreground=[('disabled', 'black'),
|
||||
('pressed', 'white'),
|
||||
('active', 'white')],
|
||||
background=[('disabled', 'black'),
|
||||
('pressed', '!focus', 'black'),
|
||||
('active', 'black')],
|
||||
highlightcolor=[('focus', 'black'),
|
||||
('!focus', 'black')])
|
||||
|
||||
def configure_style(style):
|
||||
style.configure('TButton', **style_dict)
|
||||
style.map('TButton', **map_options)
|
||||
style.configure('TLabel', **style_dict)
|
||||
#style.configure('TEntry', **style_dict)
|
||||
#style.map('TEntry', **map_options)
|
||||
|
||||
# A hack to change entry style
|
||||
style.element_create("plain.field", "from", "clam")
|
||||
style.layout("EntryStyle.TEntry",
|
||||
[('Entry.plain.field', {'children': [(
|
||||
'Entry.background', {'children': [(
|
||||
'Entry.padding', {'children': [(
|
||||
'Entry.textarea', {'sticky': 'nswe'})],
|
||||
'sticky': 'nswe'})], 'sticky': 'nswe'})],
|
||||
'border':'2', 'sticky': 'nswe'})])
|
||||
style.configure("EntryStyle.TEntry",
|
||||
background="black",
|
||||
foreground="white",
|
||||
fieldbackground="black")
|
||||
Reference in New Issue
Block a user