Sep-27-2022, 12:30 PM
Hi Guys,
I need your help
This Stuff is working well:
I also found out that this (below) works well, but i find it not an elegant style to create an object "Frame01.frame" , and also I would like to understand the issue about my original code...

I need your help

This Stuff is working well:
import tkinter as tk from tkinter import * from tkinter import ttk, filedialog ## window win = Tk() # Create an instance of tkinter frame win.title(' F04 universal GUI ') #set title of window myscreenwidth= win.winfo_screenwidth() #get screenwidth myscreenheight= win.winfo_screenheight() #get screenheight win.geometry("%dx%d+0+0" %(myscreenwidth,myscreenheight)) #set window size to full screen[b][/b]But now i want to create a new class for my frames ( -> same attributes (like background color) for all instances), which does not really work:
#define a notebook notebook1=ttk.Notebook(win) #initialise notebook1.pack(fill="both", expand=1) #most simple placement for only 1 object class CustomFrames(tk.Frame): def __init__(self,notebook1): super().__init__(notebook1) super().notebook1.add(self.frame, text="Start ") frame01Start=CustomFrames(notebook1) #create instance
Error:super().notebook1.add(self.frame, text="Start ")
AttributeError: 'super' object has no attribute 'notebook1'
Any ideas whats wrong here?I also found out that this (below) works well, but i find it not an elegant style to create an object "Frame01.frame" , and also I would like to understand the issue about my original code...
class CustomFrames: def __init__(self): self.frame=tk.Frame(notebook1)Thank you for your help!
