Мне нужно добавить модули Frames.py и view.py.
Мне нужно добавить background='#bfbfbf'
в проект, но добавить только root?
код view.py:
from tkinter import Toplevel, Label, Message, ttk
from content import frames
from tkinter.ttk import *
class MainPage():
"""Main interface"""
def __init__(self, master=None, **kw):
super().__init__(**kw)
self.root = master # Main window
self.root.resizable(False, False)
self.root.geometry('300x300')
self.root.config(background='#bfbfbf') # this add just outside project
self.style = ttk.Style()
self.style.theme_use('clam')
self.style.configure('TLabel', background='#bfbfbf')
self.style.configure('TButton', background='#bfbfbf')
код Frames.py:
from tkinter import Button, Label, Frame
from tkinter.ttk import *
class HomeFrame(Frame): # Inherit Frame class
"""Application main interface"""
def __init__(self, parent=None, **kw):
Frame.__init__(self, parent)
super().__init__(**kw)
self.root = parent # Define internal variable root
self.home_page()
def init_page(self):
"""Load control"""
Label(self, text="First name").grid(row=0, column=0, padx=20, pady=20)
Full_name = Button(self, text="Get Full name")
Full_name.grid(row=0, column=1, columnspan=2, padx=20, pady=20)
Label(self, text="Last name").grid(row=1, column=0, padx=20, pady=20)
hello = Button(self, text="hello")
hello.grid(row=3, column=2, columnspan=2, padx=20, pady=20)
Результат:
Любые изменения для этого кода?