Getting an error on the following code. Keep looking at examples and re-evaluating code but cannot really spot any reason this shouldn't run. Is there anything incorrect such that the 'mRRed'
layout cannot be found? (And I'm sure the subsequent)...
import tkinter as tk
from tkinter import ttk
class MainFrame:
def __init__(self,parent):
self.frame = ttk.Frame(parent,padding='3 3 12 12')
self.frame.grid(column=0, row=0)
self.mRRed = ttk.Style()
self.mRBlue = ttk.Style()
self.mPurple = ttk.Style()
self.mPink = ttk.Style()
self.mSCyan = ttk.Style()
self.mVYellow = ttk.Style()
self.mGreen = ttk.Style()
self.mRRed.configure("mRRed",background="#E61E50")
self.mRBlue.configure("mRBlue",background="#0F69AF")
self.mPurple.configure("mPurple",background="#503291")
self.mPink.configure("mPink",background="#EB3C96")
self.mSCyan.configure("mSCyan",background="#2BDECD")
self.mVYellow.configure("mVYellow",background="#FFC832")
self.mGreen.configure("mGreen",background="#149B5F")
self.toolRibbon = ttk.Frame(self.frame, style='mRRed')
self.subtoolRibbon = ttk.Frame(self.frame, style='mRBlue')
self.titleFrame = ttk.Frame(self.frame, style='mPruple')
self.contentFrame = ttk.Frame(self.frame, style='mPink')
self.optionRibbon = ttk.Frame(self.frame, style='mSCyan')
self.statusFrame = ttk.Frame(self.frame, style='mVYellow')
self.infoFrame = ttk.Frame(self.frame, style='mGreen')
self.toolRibbon.grid(column=0,row=0)
self.subtoolRibbon.grid(column=0,row=1)
self.titleFrame.grid(column=1,row=1)
self.contentFrame.grid(column=1,row=2)
self.optionRibbon.grid(column=1,row=3)
self.statusFrame.grid(column=1,row=4)
self.infoFrame.grid(column=4,row=1)
root = tk.Tk()
root.title("test")
main = MainFrame(root)
root.mainloop()
--------------------------------------------------------------------------- TclError Traceback (most recent call last) in 43 root.title("test") 44 ---> 45 main = MainFrame(root) 46 root.mainloop()
in init(self, parent) 24 25 ---> 26 self.toolRibbon = ttk.Frame(self.frame, style='mRRed') 27 self.subtoolRibbon = ttk.Frame(self.frame, style='mRBlue') 28 self.titleFrame = ttk.Frame(self.frame, style='mPruple')
D:\Programs\Anaconda\lib\tkinter\ttk.py in init(self, master, **kw) 740 borderwidth, relief, padding, width, height 741 """ --> 742 Widget.init(self, master, "ttk::frame", kw) 743 744
D:\Programs\Anaconda\lib\tkinter\ttk.py in init(self, master, widgetname, kw) 557 # Load tile now, if needed 558 _load_tile(master) --> 559 tkinter.Widget.init(self, master, widgetname, kw=kw) 560 561
D:\Programs\Anaconda\lib\tkinter__init__.py in init(self, master, widgetName, cnf, kw, extra) 2297 del cnf[k] 2298
self.tk.call( -> 2299 (widgetName, self._w) + extra + self._options(cnf)) 2300 for k, v in classes: 2301
k.configure(self, v)TclError: Layout mRRed not found
Label
they need the.TLabel
suffix. SomRRed.TLabel
, etc. – Malaria