from types import TracebackType
from typing import Any, Optional, Dict, Callable, Type
from tkinter.constants import *  # noqa: F403

TclError = ...  # type: Any
wantobjects = ...  # type: Any
TkVersion = ...  # type: Any
TclVersion = ...  # type: Any
READABLE = ...  # type: Any
WRITABLE = ...  # type: Any
EXCEPTION = ...  # type: Any

class Event: ...

def NoDefaultRoot(): ...

class Variable:
    def __init__(self, master=None, value=None, name=None): ...
    def __del__(self): ...
    def set(self, value): ...
    initialize = ...  # type: Any
    def get(self): ...
    def trace_variable(self, mode, callback): ...
    trace = ...  # type: Any
    def trace_vdelete(self, mode, cbname): ...
    def trace_vinfo(self): ...
    def __eq__(self, other): ...

class StringVar(Variable):
    def __init__(self, master=None, value=None, name=None): ...
    def get(self): ...

class IntVar(Variable):
    def __init__(self, master=None, value=None, name=None): ...
    def get(self): ...

class DoubleVar(Variable):
    def __init__(self, master=None, value=None, name=None): ...
    def get(self): ...

class BooleanVar(Variable):
    def __init__(self, master=None, value=None, name=None): ...
    def set(self, value): ...
    initialize = ...  # type: Any
    def get(self): ...

def mainloop(n=0): ...

getint = ...  # type: Any
getdouble = ...  # type: Any

def getboolean(s): ...

class Misc:
    def destroy(self): ...
    def deletecommand(self, name): ...
    def tk_strictMotif(self, boolean=None): ...
    def tk_bisque(self): ...
    def tk_setPalette(self, *args, **kw): ...
    def tk_menuBar(self, *args): ...
    def wait_variable(self, name: str = ...): ...
    waitvar = ...  # type: Any
    def wait_window(self, window=None): ...
    def wait_visibility(self, window=None): ...
    def setvar(self, name: str = ..., value: str = ...): ...
    def getvar(self, name: str = ...): ...
    def getint(self, s): ...
    def getdouble(self, s): ...
    def getboolean(self, s): ...
    def focus_set(self): ...
    focus = ...  # type: Any
    def focus_force(self): ...
    def focus_get(self): ...
    def focus_displayof(self): ...
    def focus_lastfor(self): ...
    def tk_focusFollowsMouse(self): ...
    def tk_focusNext(self): ...
    def tk_focusPrev(self): ...
    def after(self, ms, func=None, *args): ...
    def after_idle(self, func, *args): ...
    def after_cancel(self, id): ...
    def bell(self, displayof=0): ...
    def clipboard_get(self, **kw): ...
    def clipboard_clear(self, **kw): ...
    def clipboard_append(self, string, **kw): ...
    def grab_current(self): ...
    def grab_release(self): ...
    def grab_set(self): ...
    def grab_set_global(self): ...
    def grab_status(self): ...
    def option_add(self, pattern, value, priority=None): ...
    def option_clear(self): ...
    def option_get(self, name, className): ...
    def option_readfile(self, fileName, priority=None): ...
    def selection_clear(self, **kw): ...
    def selection_get(self, **kw): ...
    def selection_handle(self, command, **kw): ...
    def selection_own(self, **kw): ...
    def selection_own_get(self, **kw): ...
    def send(self, interp, cmd, *args): ...
    def lower(self, belowThis=None): ...
    def tkraise(self, aboveThis=None): ...
    lift = ...  # type: Any
    def winfo_atom(self, name, displayof=0): ...
    def winfo_atomname(self, id, displayof=0): ...
    def winfo_cells(self): ...
    def winfo_children(self): ...
    def winfo_class(self): ...
    def winfo_colormapfull(self): ...
    def winfo_containing(self, rootX, rootY, displayof=0): ...
    def winfo_depth(self): ...
    def winfo_exists(self): ...
    def winfo_fpixels(self, number): ...
    def winfo_geometry(self): ...
    def winfo_height(self): ...
    def winfo_id(self): ...
    def winfo_interps(self, displayof=0): ...
    def winfo_ismapped(self): ...
    def winfo_manager(self): ...
    def winfo_name(self): ...
    def winfo_parent(self): ...
    def winfo_pathname(self, id, displayof=0): ...
    def winfo_pixels(self, number): ...
    def winfo_pointerx(self): ...
    def winfo_pointerxy(self): ...
    def winfo_pointery(self): ...
    def winfo_reqheight(self): ...
    def winfo_reqwidth(self): ...
    def winfo_rgb(self, color): ...
    def winfo_rootx(self): ...
    def winfo_rooty(self): ...
    def winfo_screen(self): ...
    def winfo_screencells(self): ...
    def winfo_screendepth(self): ...
    def winfo_screenheight(self): ...
    def winfo_screenmmheight(self): ...
    def winfo_screenmmwidth(self): ...
    def winfo_screenvisual(self): ...
    def winfo_screenwidth(self): ...
    def winfo_server(self): ...
    def winfo_toplevel(self): ...
    def winfo_viewable(self): ...
    def winfo_visual(self): ...
    def winfo_visualid(self): ...
    def winfo_visualsavailable(self, includeids=0): ...
    def winfo_vrootheight(self): ...
    def winfo_vrootwidth(self): ...
    def winfo_vrootx(self): ...
    def winfo_vrooty(self): ...
    def winfo_width(self): ...
    def winfo_x(self): ...
    def winfo_y(self): ...
    def update(self): ...
    def update_idletasks(self): ...
    def bindtags(self, tagList=None): ...
    def bind(self, sequence=None, func=None, add=None): ...
    def unbind(self, sequence, funcid=None): ...
    def bind_all(self, sequence=None, func=None, add=None): ...
    def unbind_all(self, sequence): ...
    def bind_class(self, className, sequence=None, func=None, add=None): ...
    def unbind_class(self, className, sequence): ...
    def mainloop(self, n=0): ...
    def quit(self): ...
    def nametowidget(self, name): ...
    register = ...  # type: Any
    def configure(self, cnf=None, **kw): ...
    config = ...  # type: Any
    def cget(self, key): ...
    __getitem__ = ...  # type: Any
    def __setitem__(self, key, value): ...
    def keys(self): ...
    def pack_propagate(self, flag=...): ...
    propagate = ...  # type: Any
    def pack_slaves(self): ...
    slaves = ...  # type: Any
    def place_slaves(self): ...
    def grid_anchor(self, anchor=None): ...
    anchor = ...  # type: Any
    def grid_bbox(self, column=None, row=None, col2=None, row2=None): ...
    bbox = ...  # type: Any
    def grid_columnconfigure(self, index, cnf=..., **kw): ...
    columnconfigure = ...  # type: Any
    def grid_location(self, x, y): ...
    def grid_propagate(self, flag=...): ...
    def grid_rowconfigure(self, index, cnf=..., **kw): ...
    rowconfigure = ...  # type: Any
    def grid_size(self): ...
    size = ...  # type: Any
    def grid_slaves(self, row=None, column=None): ...
    def event_add(self, virtual, *sequences): ...
    def event_delete(self, virtual, *sequences): ...
    def event_generate(self, sequence, **kw): ...
    def event_info(self, virtual=None): ...
    def image_names(self): ...
    def image_types(self): ...

class CallWrapper:
    func = ...  # type: Any
    subst = ...  # type: Any
    widget = ...  # type: Any
    def __init__(self, func, subst, widget): ...
    def __call__(self, *args): ...

class XView:
    def xview(self, *args): ...
    def xview_moveto(self, fraction): ...
    def xview_scroll(self, number, what): ...

class YView:
    def yview(self, *args): ...
    def yview_moveto(self, fraction): ...
    def yview_scroll(self, number, what): ...

class Wm:
    def wm_aspect(self, minNumer=None, minDenom=None, maxNumer=None, maxDenom=None): ...
    aspect = ...  # type: Any
    def wm_attributes(self, *args): ...
    attributes = ...  # type: Any
    def wm_client(self, name=None): ...
    client = ...  # type: Any
    def wm_colormapwindows(self, *wlist): ...
    colormapwindows = ...  # type: Any
    def wm_command(self, value=None): ...
    command = ...  # type: Any
    def wm_deiconify(self): ...
    deiconify = ...  # type: Any
    def wm_focusmodel(self, model=None): ...
    focusmodel = ...  # type: Any
    def wm_forget(self, window): ...
    forget = ...  # type: Any
    def wm_frame(self): ...
    frame = ...  # type: Any
    def wm_geometry(self, newGeometry=None): ...
    geometry = ...  # type: Any
    def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None): ...
    grid = ...  # type: Any
    def wm_group(self, pathName=None): ...
    group = ...  # type: Any
    def wm_iconbitmap(self, bitmap=None, default=None): ...
    iconbitmap = ...  # type: Any
    def wm_iconify(self): ...
    iconify = ...  # type: Any
    def wm_iconmask(self, bitmap=None): ...
    iconmask = ...  # type: Any
    def wm_iconname(self, newName=None): ...
    iconname = ...  # type: Any
    def wm_iconphoto(self, default=False, *args): ...
    iconphoto = ...  # type: Any
    def wm_iconposition(self, x=None, y=None): ...
    iconposition = ...  # type: Any
    def wm_iconwindow(self, pathName=None): ...
    iconwindow = ...  # type: Any
    def wm_manage(self, widget): ...
    manage = ...  # type: Any
    def wm_maxsize(self, width=None, height=None): ...
    maxsize = ...  # type: Any
    def wm_minsize(self, width=None, height=None): ...
    minsize = ...  # type: Any
    def wm_overrideredirect(self, boolean=None): ...
    overrideredirect = ...  # type: Any
    def wm_positionfrom(self, who=None): ...
    positionfrom = ...  # type: Any
    def wm_protocol(self, name=None, func=None): ...
    protocol = ...  # type: Any
    def wm_resizable(self, width=None, height=None): ...
    resizable = ...  # type: Any
    def wm_sizefrom(self, who=None): ...
    sizefrom = ...  # type: Any
    def wm_state(self, newstate=None): ...
    state = ...  # type: Any
    def wm_title(self, string=None): ...
    title = ...  # type: Any
    def wm_transient(self, master=None): ...
    transient = ...  # type: Any
    def wm_withdraw(self): ...
    withdraw = ...  # type: Any

class Tk(Misc, Wm):
    master: Optional[Any]
    children: Dict[str, Any]
    tk: Any
    def __init__(self, screenName: Optional[str] = ..., baseName: Optional[str] = ..., className: str = ..., useTk: bool = ...,
                 sync: bool = ..., use: Optional[str] = ...) -> None: ...
    def loadtk(self) -> None: ...
    def destroy(self) -> None: ...
    def readprofile(self, baseName: str, className: str) -> None: ...
    report_callback_exception: Callable[[Type[BaseException], BaseException, TracebackType], Any]
    def __getattr__(self, attr: str) -> Any: ...

def Tcl(screenName=None, baseName=None, className: str = ..., useTk=0): ...

class Pack:
    def pack_configure(self, cnf=..., **kw): ...
    pack = ...  # type: Any
    def pack_forget(self): ...
    forget = ...  # type: Any
    def pack_info(self): ...
    info = ...  # type: Any
    propagate = ...  # type: Any
    slaves = ...  # type: Any

class Place:
    def place_configure(self, cnf=..., **kw): ...
    place = ...  # type: Any
    def place_forget(self): ...
    forget = ...  # type: Any
    def place_info(self): ...
    info = ...  # type: Any
    slaves = ...  # type: Any

class Grid:
    def grid_configure(self, cnf=..., **kw): ...
    grid = ...  # type: Any
    bbox = ...  # type: Any
    columnconfigure = ...  # type: Any
    def grid_forget(self): ...
    forget = ...  # type: Any
    def grid_remove(self): ...
    def grid_info(self): ...
    info = ...  # type: Any
    location = ...  # type: Any
    propagate = ...  # type: Any
    rowconfigure = ...  # type: Any
    size = ...  # type: Any
    slaves = ...  # type: Any

class BaseWidget(Misc):
    widgetName = ...  # type: Any
    def __init__(self, master, widgetName, cnf=..., kw=..., extra=...): ...
    def destroy(self): ...

class Widget(BaseWidget, Pack, Place, Grid): ...

class Toplevel(BaseWidget, Wm):
    def __init__(self, master=None, cnf=..., **kw): ...

class Button(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def flash(self): ...
    def invoke(self): ...

class Canvas(Widget, XView, YView):
    def __init__(self, master=None, cnf=..., **kw): ...
    def addtag(self, *args): ...
    def addtag_above(self, newtag, tagOrId): ...
    def addtag_all(self, newtag): ...
    def addtag_below(self, newtag, tagOrId): ...
    def addtag_closest(self, newtag, x, y, halo=None, start=None): ...
    def addtag_enclosed(self, newtag, x1, y1, x2, y2): ...
    def addtag_overlapping(self, newtag, x1, y1, x2, y2): ...
    def addtag_withtag(self, newtag, tagOrId): ...
    def bbox(self, *args): ...
    def tag_unbind(self, tagOrId, sequence, funcid=None): ...
    def tag_bind(self, tagOrId, sequence=None, func=None, add=None): ...
    def canvasx(self, screenx, gridspacing=None): ...
    def canvasy(self, screeny, gridspacing=None): ...
    def coords(self, *args): ...
    def create_arc(self, *args, **kw): ...
    def create_bitmap(self, *args, **kw): ...
    def create_image(self, *args, **kw): ...
    def create_line(self, *args, **kw): ...
    def create_oval(self, *args, **kw): ...
    def create_polygon(self, *args, **kw): ...
    def create_rectangle(self, *args, **kw): ...
    def create_text(self, *args, **kw): ...
    def create_window(self, *args, **kw): ...
    def dchars(self, *args): ...
    def delete(self, *args): ...
    def dtag(self, *args): ...
    def find(self, *args): ...
    def find_above(self, tagOrId): ...
    def find_all(self): ...
    def find_below(self, tagOrId): ...
    def find_closest(self, x, y, halo=None, start=None): ...
    def find_enclosed(self, x1, y1, x2, y2): ...
    def find_overlapping(self, x1, y1, x2, y2): ...
    def find_withtag(self, tagOrId): ...
    def focus(self, *args): ...
    def gettags(self, *args): ...
    def icursor(self, *args): ...
    def index(self, *args): ...
    def insert(self, *args): ...
    def itemcget(self, tagOrId, option): ...
    def itemconfigure(self, tagOrId, cnf=None, **kw): ...
    itemconfig = ...  # type: Any
    def tag_lower(self, *args): ...
    lower = ...  # type: Any
    def move(self, *args): ...
    def postscript(self, cnf=..., **kw): ...
    def tag_raise(self, *args): ...
    lift = ...  # type: Any
    def scale(self, *args): ...
    def scan_mark(self, x, y): ...
    def scan_dragto(self, x, y, gain=10): ...
    def select_adjust(self, tagOrId, index): ...
    def select_clear(self): ...
    def select_from(self, tagOrId, index): ...
    def select_item(self): ...
    def select_to(self, tagOrId, index): ...
    def type(self, tagOrId): ...

class Checkbutton(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def deselect(self): ...
    def flash(self): ...
    def invoke(self): ...
    def select(self): ...
    def toggle(self): ...

class Entry(Widget, XView):
    def __init__(self, master=None, cnf=..., **kw): ...
    def delete(self, first, last=None): ...
    def get(self): ...
    def icursor(self, index): ...
    def index(self, index): ...
    def insert(self, index, string): ...
    def scan_mark(self, x): ...
    def scan_dragto(self, x): ...
    def selection_adjust(self, index): ...
    select_adjust = ...  # type: Any
    def selection_clear(self): ...
    select_clear = ...  # type: Any
    def selection_from(self, index): ...
    select_from = ...  # type: Any
    def selection_present(self): ...
    select_present = ...  # type: Any
    def selection_range(self, start, end): ...
    select_range = ...  # type: Any
    def selection_to(self, index): ...
    select_to = ...  # type: Any

class Frame(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...

class Label(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...

class Listbox(Widget, XView, YView):
    def __init__(self, master=None, cnf=..., **kw): ...
    def activate(self, index): ...
    def bbox(self, index): ...
    def curselection(self): ...
    def delete(self, first, last=None): ...
    def get(self, first, last=None): ...
    def index(self, index): ...
    def insert(self, index, *elements): ...
    def nearest(self, y): ...
    def scan_mark(self, x, y): ...
    def scan_dragto(self, x, y): ...
    def see(self, index): ...
    def selection_anchor(self, index): ...
    select_anchor = ...  # type: Any
    def selection_clear(self, first, last=None): ...
    select_clear = ...  # type: Any
    def selection_includes(self, index): ...
    select_includes = ...  # type: Any
    def selection_set(self, first, last=None): ...
    select_set = ...  # type: Any
    def size(self): ...
    def itemcget(self, index, option): ...
    def itemconfigure(self, index, cnf=None, **kw): ...
    itemconfig = ...  # type: Any

class Menu(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def tk_popup(self, x, y, entry: str = ...): ...
    def tk_bindForTraversal(self): ...
    def activate(self, index): ...
    def add(self, itemType, cnf=..., **kw): ...
    def add_cascade(self, cnf=..., **kw): ...
    def add_checkbutton(self, cnf=..., **kw): ...
    def add_command(self, cnf=..., **kw): ...
    def add_radiobutton(self, cnf=..., **kw): ...
    def add_separator(self, cnf=..., **kw): ...
    def insert(self, index, itemType, cnf=..., **kw): ...
    def insert_cascade(self, index, cnf=..., **kw): ...
    def insert_checkbutton(self, index, cnf=..., **kw): ...
    def insert_command(self, index, cnf=..., **kw): ...
    def insert_radiobutton(self, index, cnf=..., **kw): ...
    def insert_separator(self, index, cnf=..., **kw): ...
    def delete(self, index1, index2=None): ...
    def entrycget(self, index, option): ...
    def entryconfigure(self, index, cnf=None, **kw): ...
    entryconfig = ...  # type: Any
    def index(self, index): ...
    def invoke(self, index): ...
    def post(self, x, y): ...
    def type(self, index): ...
    def unpost(self): ...
    def xposition(self, index): ...
    def yposition(self, index): ...

class Menubutton(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...

class Message(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...

class Radiobutton(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def deselect(self): ...
    def flash(self): ...
    def invoke(self): ...
    def select(self): ...

class Scale(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def get(self): ...
    def set(self, value): ...
    def coords(self, value=None): ...
    def identify(self, x, y): ...

class Scrollbar(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def activate(self, index=None): ...
    def delta(self, deltax, deltay): ...
    def fraction(self, x, y): ...
    def identify(self, x, y): ...
    def get(self): ...
    def set(self, first, last): ...

class Text(Widget, XView, YView):
    def __init__(self, master=None, cnf=..., **kw): ...
    def bbox(self, index): ...
    def compare(self, index1, op, index2): ...
    def count(self, index1, index2, *args): ...
    def debug(self, boolean=None): ...
    def delete(self, index1, index2=None): ...
    def dlineinfo(self, index): ...
    def dump(self, index1, index2=None, command=None, **kw): ...
    def edit(self, *args): ...
    def edit_modified(self, arg=None): ...
    def edit_redo(self): ...
    def edit_reset(self): ...
    def edit_separator(self): ...
    def edit_undo(self): ...
    def get(self, index1, index2=None): ...
    def image_cget(self, index, option): ...
    def image_configure(self, index, cnf=None, **kw): ...
    def image_create(self, index, cnf=..., **kw): ...
    def image_names(self): ...
    def index(self, index): ...
    def insert(self, index, chars, *args): ...
    def mark_gravity(self, markName, direction=None): ...
    def mark_names(self): ...
    def mark_set(self, markName, index): ...
    def mark_unset(self, *markNames): ...
    def mark_next(self, index): ...
    def mark_previous(self, index): ...
    def peer_create(self, newPathName, cnf=..., **kw): ...
    def peer_names(self): ...
    def replace(self, index1, index2, chars, *args): ...
    def scan_mark(self, x, y): ...
    def scan_dragto(self, x, y): ...
    def search(self, pattern, index, stopindex=None, forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None, elide=None): ...
    def see(self, index): ...
    def tag_add(self, tagName, index1, *args): ...
    def tag_unbind(self, tagName, sequence, funcid=None): ...
    def tag_bind(self, tagName, sequence, func, add=None): ...
    def tag_cget(self, tagName, option): ...
    def tag_configure(self, tagName, cnf=None, **kw): ...
    tag_config = ...  # type: Any
    def tag_delete(self, *tagNames): ...
    def tag_lower(self, tagName, belowThis=None): ...
    def tag_names(self, index=None): ...
    def tag_nextrange(self, tagName, index1, index2=None): ...
    def tag_prevrange(self, tagName, index1, index2=None): ...
    def tag_raise(self, tagName, aboveThis=None): ...
    def tag_ranges(self, tagName): ...
    def tag_remove(self, tagName, index1, index2=None): ...
    def window_cget(self, index, option): ...
    def window_configure(self, index, cnf=None, **kw): ...
    window_config = ...  # type: Any
    def window_create(self, index, cnf=..., **kw): ...
    def window_names(self): ...
    def yview_pickplace(self, *what): ...

class _setit:
    def __init__(self, var, value, callback=None): ...
    def __call__(self, *args): ...

class OptionMenu(Menubutton):
    widgetName = ...  # type: Any
    menuname = ...  # type: Any
    def __init__(self, master, variable, value, *values, **kwargs): ...
    def __getitem__(self, name): ...
    def destroy(self): ...

class Image:
    name = ...  # type: Any
    tk = ...  # type: Any
    def __init__(self, imgtype, name=None, cnf=..., master=None, **kw): ...
    def __del__(self): ...
    def __setitem__(self, key, value): ...
    def __getitem__(self, key): ...
    def configure(self, **kw): ...
    config = ...  # type: Any
    def height(self): ...
    def type(self): ...
    def width(self): ...

class PhotoImage(Image):
    def __init__(self, name=None, cnf=..., master=None, **kw): ...
    def blank(self): ...
    def cget(self, option): ...
    def __getitem__(self, key): ...
    def copy(self): ...
    def zoom(self, x, y: str = ...): ...
    def subsample(self, x, y: str = ...): ...
    def get(self, x, y): ...
    def put(self, data, to=None): ...
    def write(self, filename, format=None, from_coords=None): ...

class BitmapImage(Image):
    def __init__(self, name=None, cnf=..., master=None, **kw): ...

def image_names(): ...
def image_types(): ...

class Spinbox(Widget, XView):
    def __init__(self, master=None, cnf=..., **kw): ...
    def bbox(self, index): ...
    def delete(self, first, last=None): ...
    def get(self): ...
    def icursor(self, index): ...
    def identify(self, x, y): ...
    def index(self, index): ...
    def insert(self, index, s): ...
    def invoke(self, element): ...
    def scan(self, *args): ...
    def scan_mark(self, x): ...
    def scan_dragto(self, x): ...
    def selection(self, *args): ...
    def selection_adjust(self, index): ...
    def selection_clear(self): ...
    def selection_element(self, element=None): ...

class LabelFrame(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...

class PanedWindow(Widget):
    def __init__(self, master=None, cnf=..., **kw): ...
    def add(self, child, **kw): ...
    def remove(self, child): ...
    forget = ...  # type: Any
    def identify(self, x, y): ...
    def proxy(self, *args): ...
    def proxy_coord(self): ...
    def proxy_forget(self): ...
    def proxy_place(self, x, y): ...
    def sash(self, *args): ...
    def sash_coord(self, index): ...
    def sash_mark(self, index): ...
    def sash_place(self, index, x, y): ...
    def panecget(self, child, option): ...
    def paneconfigure(self, tagOrId, cnf=None, **kw): ...
    paneconfig = ...  # type: Any
    def panes(self): ...
