Answer the question
In order to leave comments, you need to log in
tkinter error?
I am writing my text editor and wanted to make tabs but got an error:
Traceback (most recent call last):
File "C:\Users\User\Downloads\Tornado\main.py", line 35, in
nb = Notebook()
NameError : name 'Notebook' is not defined
Code (not all):
import tkinter as tk
from tkinter import *
import tkinter.ttk as ttk
from tkinter import filedialog
from tkinter import messagebox
import os
from hashlib import md5
from pygments.lexers import PythonLexer
from tokens import token_type_to_tag
lexer = PythonLexer()
class Document:
def __init__(self, Frame, TextWidget, FileDir=''):
self.file_dir = FileDir
self.file_name = 'Untitled'if not FileDir else os.path.basename(FileDir)
self.text = TextWidget
self.status = md5(self.text.get(1.0, 'end').encode('utf-8'))
app = Tk()
app.title("Tornado")
app.iconbitmap("tornado.ico")
app.geometry("1260x600")
frame = Frame(app)
frame.pack()
filetypes = (("Normal text file", "*.txt"), ("All files", "*.*"))
init_dir = os.path.join(os.path.expanduser('~'), 'Desktop')
tabs = {}
nb = Notebook()
nb.bind("<Button-2>", close_tab)
nb.bind("<B1-Motion>", move_tab)
nb.pack(expand=1, fill="both")
nb.enable_traversal()
app.protocol('WM_DELETE_WINDOW', exit)
notebook.bind("<<NotebookTabChanged>>", select_tab)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question