Tkinter AttributeError: object has no attribute 'tk'

前端 未结 1 1464
Happy的楠姐
Happy的楠姐 2020-12-09 10:02

I\'ve looked around a bit, but I can\'t find an answer to my error. Here is the code:

import tkinter as tk

root=tk.Tk()

class Page(tk.Frame):
    \'\'\'Ena         


        
相关标签:
1条回答
  • 2020-12-09 10:56

    Your Page init method should call Frame's init.

    class Page(tk.Frame):
        '''Enables switching between pages of a window.'''
        def __init__(self):
            super(Page, self).__init__()
            self.widgets={}
            self.grid(column=0,row=0)
    
    0 讨论(0)
提交回复
热议问题