Answer the question
In order to leave comments, you need to log in
VS Code, Python and a bunch of bugs. Just Tk() or tk.Tk()?
Hello. I am learning python using vs code. I came across two options for calling a tkinter frame:
1.
from tkinter import *
window = Tk() # пример
import tkinter as tk
window = tk.Tk()
wildcard import tkinter
spoiler
Unused import(s) enum, sys, types, TclError, re, wantobjects, TkVersion, TclVersion, READABLE, WRITABLE, EXCEPTION, EventType, Event, NoDefaultRoot, Variable, StringVar, IntVar, DoubleVar, BooleanVar, mainloop, getint, getdouble, getboolean, Misc, CallWrapper, XView, YView, Wm, Tcl, Pack, Place, Grid, BaseWidget, Widget, Toplevel, Canvas, Checkbutton, Entry, Frame, Label, Listbox, Menu, Menubutton, Message, Radiobutton, Scale, Scrollbar, Text, OptionMenu, Image, PhotoImage, BitmapImage, image_names, image_types, Spinbox, LabelFrame, PanedWindow, NO, FALSE, OFF, YES, TRUE, ON, N, S, W, E, NW, SW, NE, SE, NS, EW, NSEW, CENTER, NONE, X, Y, BOTH, LEFT, TOP, RIGHT, BOTTOM, RAISED, SUNKEN, FLAT, RIDGE, GROOVE, SOLID, HORIZONTAL, VERTICAL, NUMERIC, CHAR, WORD, BASELINE, INSIDE, OUTSIDE, SEL, SEL_FIRST, SEL_LAST, END, INSERT, CURRENT, ANCHOR, ALL, NORMAL, DISABLED, ACTIVE, HIDDEN, CASCADE, CHECKBUTTON, COMMAND, RADIOBUTTON, SEPARATOR, SINGLE, BROWSE, MULTIPLE, EXTENDED, DOTBOX, UNDERLINE, PIESLICE, CHORD, ARC, FIRST, LAST, BUTT, PROJECTING, ROUND, BEVEL, MITER, MOVETO, SCROLL, UNITS and PAGES from wildcard import of tkinter
Module name "12" doesn't conform to snake_case naming style
wildcard import tkinter pylint
"python.linting.pylintArgs": [
"--disable=C0111",
"--disable=C0103"
]
An exception occurred NameError
name 'tk' is not defined
An exception occurred NameError
name 'tk' is not defined
Answer the question
In order to leave comments, you need to log in
1. Yes, these are not errors, but the usual warnings that the code written somewhere does not comply with PEP8. In principle, I would disable all PEP8 warnings, they will not affect the highlighting of syntax and other errors in any way.
2. It's better not to import the contents of the module through *, in order to avoid confusion.
import tkinter as tk
- normal option
3.
Appears when I switch to another vs code window and backand before switching the tkinter window normally appears? Is there another file nearby by any chance
tkinter.py
? Although according to the wildcard warnings, it seems that it is not. Please attach the full code and the full error you are getting.
First, these are not errors, but linter warnings. Secondly, it is better to learn without an IDE .
What to use to stop fixing bugs and start learning Python?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question