def doGUI(self, hostname=None):
        self.master = Tk()
        self.master.title('Blessclient - MFA')
        textmsg = 'Enter your AWS MFA code: '
        if hostname:
            textmsg = 'Enter your AWS MFA code to connect to {}: '.format(
                hostname)
        Label(self.master, text=textmsg).grid(row=0)
        self.e1 = Entry(self.master)
        self.e1.grid(row=0, column=1, padx=4)
        Button(self.master,
               text='OK',
               command=self.show_entry_fields,
               default=ACTIVE).grid(row=3, column=0, sticky=W, pady=4)
        Button(self.master, text='Cancel', command=self.quit).grid(row=3,
                                                                   column=1,
                                                                   sticky=W,
                                                                   pady=4)

        self.center()
        self.master.bind('<Return>', self.show_entry_fields)
        self.master.lift()
        self.master.attributes('-topmost', True)
        self.master.focus_force()
        self.e1.focus_set()

        if platform.system() == 'Darwin':
            # Hack to get the GUI dialog focused in OSX
            # https://stackoverflow.com/questions/1892339/how-to-make-a-tkinter-window-jump-to-the-front/37235492#37235492
            tmpl = 'tell application "System Events" to set frontmost of every process whose unix id is {} to true'
            script = tmpl.format(os.getpid())
            subprocess.check_call(['/usr/bin/osascript', '-e', script])

        mainloop()
    def __init__(self): 
        '''Create a main controller for the game.
        Create the GUI. Run the game.'''
        
        self._set_cwd()
        self._game_files_setup()

        # create the UI
        app = Tk()
        #self.show_splash(app)
        
        self.game_frame = mock1.Game(app)
        self.game_frame.pack(fill=BOTH, expand=1)
        self.game_frame.grab_set()
        self.game_frame.focus_set()
        
        # fast access to models:
        #TODO models should be moved into this class
        self.my_grid = self.game_frame.my_grid._model
        self.enemy_grid = self.game_frame.their_grid._model
        
        # and the individual controllers
        self.my_controller = PlayerController(self.game_frame.my_grid_frame)
        self.their_controller = PlayerController(self.game_frame.their_grid_frame)
        
        # set initial variables
        self.new_game_callback()

        # add events
        self.create_hooks()
        
        # run the game
        app.mainloop()
Beispiel #3
0
 def __init__(self, root=None):
     """init"""
     self.root = root or Tk()
     self.root.title('Pylint')
     #reporter
     self.reporter = None
     #message queue for output from reporter
     self.msg_queue = six.moves.queue.Queue()
     self.msgs = []
     self.visible_msgs = []
     self.filenames = []
     self.rating = StringVar()
     self.tabs = {}
     self.report_stream = BasicStream(self)
     #gui objects
     self.lb_messages = None
     self.showhistory = None
     self.results = None
     self.btnRun = None
     self.information_box = None
     self.convention_box = None
     self.refactor_box = None
     self.warning_box = None
     self.error_box = None
     self.fatal_box = None
     self.txtModule = None
     self.status = None
     self.msg_type_dict = None
     self.init_gui()
Beispiel #4
0
    def doGUI(self, hostname=None):
        self.master = Tk()
        self.master.title('Blessclient - MFA')
        textmsg = 'Enter your AWS MFA code: '
        if hostname:
            textmsg = 'Enter your AWS MFA code to connect to {}: '.format(
                hostname)
        Label(self.master, text=textmsg).grid(row=0)
        self.e1 = Entry(self.master)
        self.e1.grid(row=0, column=1, padx=4)
        Button(self.master,
               text='OK',
               command=self.show_entry_fields,
               default=ACTIVE).grid(row=3, column=0, sticky=W, pady=4)
        Button(self.master, text='Cancel', command=self.quit).grid(row=3,
                                                                   column=1,
                                                                   sticky=W,
                                                                   pady=4)

        self.center()
        self.master.bind('<Return>', self.show_entry_fields)
        self.master.lift()
        self.master.attributes('-topmost', True)
        self.master.focus_force()
        self.e1.focus_set()

        if platform.system() == 'Darwin':
            # Hack to get the GUI dialog focused in OSX
            os.system(
                '/usr/bin/osascript -e \'tell app "Finder" to set frontmost of process "python" to true\''
            )

        mainloop()
Beispiel #5
0
def main():
    root = Tk()
    sizex = 800
    sizey = 600
    posx = 100
    posy = 100
    root.wm_geometry("%dx%d+%d+%d" % (sizex, sizey, posx, posy))

    root.grid()
    root.rowconfigure(0, weight=1)
    root.columnconfigure(0, weight=1)

    myframe = Frame(root, relief=GROOVE, bd=1)
    myframe.grid(row=0, column=0, sticky="NESW")

    myframe.rowconfigure(0, weight=1)
    myframe.columnconfigure(0, weight=1)
    myframe.columnconfigure(1, weight=0)

    canvas = Canvas(myframe)
    canvas.grid(row=0, column=0, sticky="NESW")

    frame = Frame(canvas)
    myscrollbar = Scrollbar(myframe, orient="vertical", command=canvas.yview)
    myscrollbar.grid(row=0, column=1, sticky="NESW")
    canvas.configure(yscrollcommand=myscrollbar.set)

    canvas.create_window((0, 0), window=frame, anchor='nw')
    frame.bind("<Configure>", lambda e, c=canvas: myfunction(c, e))
    data(frame)
    root.mainloop()
Beispiel #6
0
    def __init__(self, *trees):
        from math import sqrt, ceil

        self._trees = trees

        self._top = Tk()
        self._top.title('NLTK')
        self._top.bind('<Control-x>', self.destroy)
        self._top.bind('<Control-q>', self.destroy)

        cf = self._cframe = CanvasFrame(self._top)
        self._top.bind('<Control-p>', self._cframe.print_to_file)

        # Size is variable.
        self._size = IntVar(self._top)
        self._size.set(12)
        bold = ('helvetica', -self._size.get(), 'bold')
        helv = ('helvetica', -self._size.get())

        # Lay the trees out in a square.
        self._width = int(ceil(sqrt(len(trees))))
        self._widgets = []
        for i in range(len(trees)):
            widget = TreeWidget(cf.canvas(), trees[i], node_font=bold,
                                leaf_color='#008040', node_color='#004080',
                                roof_color='#004040', roof_fill='white',
                                line_color='#004040', draggable=1,
                                leaf_font=helv)
            widget.bind_click_trees(widget.toggle_collapsed)
            self._widgets.append(widget)
            cf.add_widget(widget, 0, 0)

        self._layout()
        self._cframe.pack(expand=1, fill='both')
        self._init_menubar()
Beispiel #7
0
def demo():
    from nltk import Nonterminal, CFG
    nonterminals = 'S VP NP PP P N Name V Det'
    (S, VP, NP, PP, P, N, Name, V, Det) = [Nonterminal(s)
                                           for s in nonterminals.split()]

    grammar = CFG.fromstring("""
    S -> NP VP
    PP -> P NP
    NP -> Det N
    NP -> NP PP
    VP -> V NP
    VP -> VP PP
    Det -> 'a'
    Det -> 'the'
    Det -> 'my'
    NP -> 'I'
    N -> 'dog'
    N -> 'man'
    N -> 'park'
    N -> 'statue'
    V -> 'saw'
    P -> 'in'
    P -> 'up'
    P -> 'over'
    P -> 'with'
    """)

    def cb(grammar): print(grammar)
    top = Tk()
    editor = CFGEditor(top, grammar, cb)
    Label(top, text='\nTesting CFG Editor\n').pack()
    Button(top, text='Quit', command=top.destroy).pack()
    top.mainloop()
Beispiel #8
0
 def _savecuts(self, event=None):
     root = Tk()
     root.withdraw()
     csvfile = asksaveasfile(mode='w',defaultextension='.csv',title='Choose a file to save cuts to')
     root.destroy()
     if csvfile:
         pd.DataFrame(self.gpacuts).to_csv(csvfile)
Beispiel #9
0
 def __init__(self):
     self.queue = q.Queue()
     self.model = ConcordanceSearchModel(self.queue)
     self.top = Tk()
     self._init_top(self.top)
     self._init_menubar()
     self._init_widgets(self.top)
     self.load_corpus(self.model.DEFAULT_CORPUS)
     self.after = self.top.after(POLL_INTERVAL, self._poll)
Beispiel #10
0
    def _savegrades(self, event=None):
        sorted_students = self.student_list.sort_values(by=['Last','First'])
        print(sorted_students)
        root = Tk()
        root.withdraw()
        csvfile = asksaveasfile(mode='w',defaultextension='.csv',title='Choose a file to save grades to')
        root.destroy()
        if csvfile:

            sorted_students.to_csv(csvfile)
Beispiel #11
0
def main():
    root = Tk()
    root.title("Physic test")

    root.grid()
    root.grid_columnconfigure(0, weight=1)
    root.grid_rowconfigure(0, weight=1)
    root.geometry("500x500")

    cnv = CrossTest(root)
    cnv.grid(column=0, row=0, sticky="NEWS")

    root.mainloop()
Beispiel #12
0
    def __init__(self, args):
        self.root = Tk()
        self.args = args

        # Make it invisible
        # - 0 size, top left corner, transparent.
        self.root.attributes('-alpha', 0.0)
        self.root.geometry('0x0+0+0')

        # "Show" window again and lift it to top so it can get focus,
        # otherwise dialogs will end up behind other windows
        self.root.deiconify()
        self.root.lift()
        self.root.focus_force()
Beispiel #13
0
 def _saveimport(self, event=None):
     root = Tk()
     root.withdraw()
     csvfile = asksaveasfile(mode='w',defaultextension='.csv',title='Choose a file to save registrar import to')
     root.destroy()
     if csvfile:
         sorted_students = self.student_list.sort_values(by=['Last','First'])
         finalgrades = pd.DataFrame()
         finalgrades['Name'] = sorted_students['Last'] + ', ' + sorted_students['First']
         finalgrades['EID'] = sorted_students.index
         finalgrades['Grade'] = sorted_students['Grades']
         finalgrades['Absences'] = ''
         finalgrades['Remarks'] = ''
         finalgrades['Unique'] = sorted_students['Class']
         finalgrades.to_csv(csvfile, sep='\t', index=False, encoding='utf-8')
Beispiel #14
0
def app():
    global root, sz, rz, rex0
    root = Tk()
    root.resizable(height=False, width=True)
    root.title(windowTitle)
    root.minsize(width=250, height=0)
    sz = FindZone("find", initialFind, initialText)
    sz.fld.bind("<Button-1>", launchRefresh)
    sz.fld.bind("<ButtonRelease-1>", launchRefresh)
    sz.fld.bind("<B1-Motion>", launchRefresh)
    sz.rexSel = re.compile("")
    rz = ReplaceZone("repl", initialRepl, "")
    rex0 = re.compile(r"(?<!\\)\\([0-9]+)")
    root.bind_all("<Key>", launchRefresh)
    launchRefresh(None)
    root.mainloop()
Beispiel #15
0
def main(args):
    (work, rest, geometry, debug, server, port, mode) = parse(args)
    logging.basicConfig(level="DEBUG" if debug else "INFO",
                        style='{',
                        format=FORMAT)
    app = Tk()
    app.title("Typing Watcher")
    if geometry:
        app.geometry(geometry)
    task = Task(master=app,
                work=work,
                rest=rest,
                server=server,
                port=port,
                mode=mode)
    task.pack()
    app.mainloop()
Beispiel #16
0
    def _loadcuts(self, event=None):
        filetypes = [
            ('Cuts file','*.csv'),
            ('Allfiles','*'),
            ]
        if platform.system() != 'Windows':
            filetypes.append(filetypes.pop(0)) # Reorder so the all gradefiles is selected first

        root = Tk()
        root.withdraw()
        csvfile = askopenfilename(filetypes=filetypes, title='Choose a file to load cuts from')
        root.destroy()

        if csvfile:
            cuts = pd.DataFrame.from_csv(csvfile).values.flatten()
            for i in range(len(cuts)):
                self._change(i,cuts[i])
Beispiel #17
0
def demo3():
    from nltk import Production

    (S, VP, NP, PP, P, N, Name, V, Det) = nonterminals(
        'S, VP, NP, PP, P, N, Name, V, Det'
    )

    productions = (
        # Syntactic Productions
        Production(S, [NP, VP]),
        Production(NP, [Det, N]),
        Production(NP, [NP, PP]),
        Production(VP, [VP, PP]),
        Production(VP, [V, NP, PP]),
        Production(VP, [V, NP]),
        Production(PP, [P, NP]),
        Production(PP, []),
        Production(PP, ['up', 'over', NP]),
        # Lexical Productions
        Production(NP, ['I']),
        Production(Det, ['the']),
        Production(Det, ['a']),
        Production(N, ['man']),
        Production(V, ['saw']),
        Production(P, ['in']),
        Production(P, ['with']),
        Production(N, ['park']),
        Production(N, ['dog']),
        Production(N, ['statue']),
        Production(Det, ['my']),
    )

    t = Tk()

    def destroy(e, t=t):
        t.destroy()

    t.bind('q', destroy)
    p = ProductionList(t, productions)
    p.pack(expand=1, fill='both')
    p.add_callback('select', p.markonly)
    p.add_callback('move', p.markonly)
    p.focus()
    p.mark(productions[2])
    p.mark(productions[8])
Beispiel #18
0
def demo3():
    from nltk import Production

    (S, VP, NP, PP, P, N, Name, V,
     Det) = nonterminals("S, VP, NP, PP, P, N, Name, V, Det")

    productions = (
        # Syntactic Productions
        Production(S, [NP, VP]),
        Production(NP, [Det, N]),
        Production(NP, [NP, PP]),
        Production(VP, [VP, PP]),
        Production(VP, [V, NP, PP]),
        Production(VP, [V, NP]),
        Production(PP, [P, NP]),
        Production(PP, []),
        Production(PP, ["up", "over", NP]),
        # Lexical Productions
        Production(NP, ["I"]),
        Production(Det, ["the"]),
        Production(Det, ["a"]),
        Production(N, ["man"]),
        Production(V, ["saw"]),
        Production(P, ["in"]),
        Production(P, ["with"]),
        Production(N, ["park"]),
        Production(N, ["dog"]),
        Production(N, ["statue"]),
        Production(Det, ["my"]),
    )

    t = Tk()

    def destroy(e, t=t):
        t.destroy()

    t.bind("q", destroy)
    p = ProductionList(t, productions)
    p.pack(expand=1, fill="both")
    p.add_callback("select", p.markonly)
    p.add_callback("move", p.markonly)
    p.focus()
    p.mark(productions[2])
    p.mark(productions[8])
    def __init__(self, args):
        self.root = Tk()

        # Make it invisible
        # - 0 size, top left corner, transparent.
        self.root.attributes('-alpha', 0.0)
        self.root.geometry('0x0+0+0')

        try:
            qmde_icon = os.path.join(args.devkit, 'res', 'q_logo.ico')
            self.root.iconbitmap(bitmap=qmde_icon)
        except TclError:
            pass

        # "Show" window again and lift it to top so it can get focus,
        # otherwise dialogs will end up behind other windows
        self.root.deiconify()
        self.root.lift()
        self.root.focus_force()
Beispiel #20
0
def demo():
    root = Tk()
    root.bind("<Control-q>", lambda e: root.destroy())

    table = Table(
        root,
        "Word Synset Hypernym Hyponym".split(),
        column_weights=[0, 1, 1, 1],
        reprfunc=(lambda i, j, s: "  %s" % s),
    )
    table.pack(expand=True, fill="both")

    from nltk.corpus import wordnet
    from nltk.corpus import brown

    for word, pos in sorted(set(brown.tagged_words()[:500])):
        if pos[0] != "N":
            continue
        word = word.lower()
        for synset in wordnet.synsets(word):
            try:
                hyper_def = synset.hypernyms()[0].definition()
            except:
                hyper_def = "*none*"
            try:
                hypo_def = synset.hypernyms()[0].definition()
            except:
                hypo_def = "*none*"
            table.append([word, synset.definition(), hyper_def, hypo_def])

    table.columnconfig("Word", background="#afa")
    table.columnconfig("Synset", background="#efe")
    table.columnconfig("Hypernym", background="#fee")
    table.columnconfig("Hyponym", background="#ffe")
    for row in range(len(table)):
        for column in ("Hypernym", "Hyponym"):
            if table[row, column] == "*none*":
                table.itemconfig(row,
                                 column,
                                 foreground="#666",
                                 selectforeground="#666")
    root.mainloop()
Beispiel #21
0
def demo():
    root = Tk()
    root.bind('<Control-q>', lambda e: root.destroy())

    table = Table(
        root,
        'Word Synset Hypernym Hyponym'.split(),
        column_weights=[0, 1, 1, 1],
        reprfunc=(lambda i, j, s: '  %s' % s),
    )
    table.pack(expand=True, fill='both')

    from nltk.corpus import wordnet
    from nltk.corpus import brown

    for word, pos in sorted(set(brown.tagged_words()[:500])):
        if pos[0] != 'N':
            continue
        word = word.lower()
        for synset in wordnet.synsets(word):
            try:
                hyper_def = synset.hypernyms()[0].definition()
            except:
                hyper_def = '*none*'
            try:
                hypo_def = synset.hypernyms()[0].definition()
            except:
                hypo_def = '*none*'
            table.append([word, synset.definition(), hyper_def, hypo_def])

    table.columnconfig('Word', background='#afa')
    table.columnconfig('Synset', background='#efe')
    table.columnconfig('Hypernym', background='#fee')
    table.columnconfig('Hyponym', background='#ffe')
    for row in range(len(table)):
        for column in ('Hypernym', 'Hyponym'):
            if table[row, column] == '*none*':
                table.itemconfig(row,
                                 column,
                                 foreground='#666',
                                 selectforeground='#666')
    root.mainloop()
Beispiel #22
0
def show_qr(path):
    import platform
    try:
        from six.moves.tkinter import Tk, Label
    except ImportError:
        raise SystemError('缺少Tkinter模块, 可使用sudo pip install Tkinter尝试安装')
    try:
        from PIL import ImageTk, Image
    except ImportError:
        raise SystemError('缺少PIL模块, 可使用sudo pip install PIL尝试安装')

    system = platform.system()
    if system == 'Darwin':  # 如果是Mac OS X
        img = Image.open(path)
        img.show()
    else:
        root = Tk()
        img = ImageTk.PhotoImage(Image.open(path))
        panel = Label(root, image=img)
        panel.pack(side="bottom", fill="both", expand="yes")
        root.mainloop()
Beispiel #23
0
def ask_filenames():
    filetypes = [
            ('Allfiles','*'),
            ('Canvas grade file','*.csv'),
            ]
    if platform.system() != 'Windows':
        filetypes.append(filetypes.pop(0)) # Reorder so the all gradefiles is selected first

    root = Tk()
    root.withdraw()
    filenames = askopenfilenames(filetypes=filetypes,
                             title='Select a file or files to open')
    root.destroy()

    # Fix for broken Windows Tk
    if isinstance(filenames,string_types):
        filenames_extra = re.findall('\{(.*?)\}',filenames)
        filenames = re.sub('\{(.*?)\}','',filenames)
        filenames = filenames.split() + filenames_extra

    return filenames
Beispiel #24
0
def main():
    root = Tk()
    root.title("Test VarTreeview")

    device_tree = VarTreeview(root)
    device_tree["columns"] = ("Macros")

    dev = StringVar()
    macro = StringVar()
    dev.set("Devices")
    macro.set("Macros")

    device_tree.heading("#0", text=dev)
    device_tree.heading("Macros", text=macro)

    device_tree.grid(sticky="NEWS")

    test = Mytest(600, dev, macro)
    test.test_begin(root)

    root.mainloop()
Beispiel #25
0
    def __init__(self, grammar, text):
        self._grammar = grammar
        self._text = text

        # Set up the main window.
        self._top = Tk()
        self._top.title('Context Free Grammar Demo')

        # Base font size
        self._size = IntVar(self._top)
        self._size.set(12) # = medium

        # Set up the key bindings
        self._init_bindings(self._top)

        # Create the basic frames
        frame1 = Frame(self._top)
        frame1.pack(side='left', fill='y', expand=0)
        self._init_menubar(self._top)
        self._init_buttons(self._top)
        self._init_grammar(frame1)
        self._init_treelet(frame1)
        self._init_workspace(self._top)
Beispiel #26
0
 def _start(self):
     super(GUIScreen, self)._start()
     self.root = Tk()
     self.root.geometry("%sx%s" % (self.size[0] * 7, self.size[1] * 15))
     self.root.bind("<Configure>", self.resize)
     if platform.system() == 'Windows':
         self.root.bind("<Control-MouseWheel>", self.change_font)
     else:
         self.root.bind("<Control-4>", self.change_font)
         self.root.bind("<Control-5>", self.change_font)
     self.root.protocol("WM_DELETE_WINDOW", self.closed_window)
     self.text = Text(self.root,
                      font="TkFixedFont",
                      wrap=Tkinter.NONE,
                      state=Tkinter.DISABLED,
                      background="black",
                      foreground="light gray")
     self.text.pack(side=Tkinter.LEFT,
                    fill=Tkinter.BOTH,
                    expand=Tkinter.YES)
     self.font = tkFont.Font(self.root, self.text.cget("font"))
     self.text.config(font=self.font)
     self.__prepare_tags()
    def __init__(self, grammar, sent, trace=0):
        self._sent = sent
        self._parser = SteppingRecursiveDescentParser(grammar, trace)

        # Set up the main window.
        self._top = Tk()
        self._top.title('Recursive Descent Parser Application')

        # Set up key bindings.
        self._init_bindings()

        # Initialize the fonts.
        self._init_fonts(self._top)

        # Animations.  animating_lock is a lock to prevent the demo
        # from performing new operations while it's animating.
        self._animation_frames = IntVar(self._top)
        self._animation_frames.set(5)
        self._animating_lock = 0
        self._autostep = 0

        # The user can hide the grammar.
        self._show_grammar = IntVar(self._top)
        self._show_grammar.set(1)

        # Create the basic frames.
        self._init_menubar(self._top)
        self._init_buttons(self._top)
        self._init_feedback(self._top)
        self._init_grammar(self._top)
        self._init_canvas(self._top)

        # Initialize the parser.
        self._parser.initialize(self._sent)

        # Resize callback
        self._canvas.bind('<Configure>', self._configure)
    def __init__(self, grammar, sent, trace=0):
        self._sent = sent
        self._parser = SteppingShiftReduceParser(grammar, trace)

        # Set up the main window.
        self._top = Tk()
        self._top.title('Shift Reduce Parser Application')

        # Animations.  animating_lock is a lock to prevent the demo
        # from performing new operations while it's animating.
        self._animating_lock = 0
        self._animate = IntVar(self._top)
        self._animate.set(10)  # = medium

        # The user can hide the grammar.
        self._show_grammar = IntVar(self._top)
        self._show_grammar.set(1)

        # Initialize fonts.
        self._init_fonts(self._top)

        # Set up key bindings.
        self._init_bindings()

        # Create the basic frames.
        self._init_menubar(self._top)
        self._init_buttons(self._top)
        self._init_feedback(self._top)
        self._init_grammar(self._top)
        self._init_canvas(self._top)

        # A popup menu for reducing.
        self._reduce_menu = Menu(self._canvas, tearoff=0)

        # Reset the demo, and set the feedback frame to empty.
        self.reset()
        self._lastoper1['text'] = ''
Beispiel #29
0
    def __init__(self, examples):
        # Set up the main window.
        self._top = Tk()
        self._top.title('DRT Glue Demo')

        # Set up key bindings.
        self._init_bindings()

        # Initialize the fonts.self._error = None
        self._init_fonts(self._top)

        self._examples = examples
        self._readingCache = [None for example in examples]

        # The user can hide the grammar.
        self._show_grammar = IntVar(self._top)
        self._show_grammar.set(1)

        # Set the data to None
        self._curExample = -1
        self._readings = []
        self._drs = None
        self._drsWidget = None
        self._error = None

        self._init_glue()

        # Create the basic frames.
        self._init_menubar(self._top)
        self._init_buttons(self._top)
        self._init_exampleListbox(self._top)
        self._init_readingListbox(self._top)
        self._init_canvas(self._top)

        # Resize callback
        self._canvas.bind('<Configure>', self._configure)
Beispiel #30
0
def main():
    root = Tk()

    frame = add_scrollbars(root, Frame, wheel=True)

    if False:

        def event_break(e):
            print("breaking %r" % e)
            return "break"

        frame.bind_all("<Button-4>", event_break, "+")

    lb = Label(frame, text="Label")
    lb.pack(fill=BOTH, side=TOP)

    cb = Combobox(frame, values=("1", "2", "3"))
    cb.pack(fill=BOTH, side=TOP)

    text = Text(frame)
    text.pack(fill=BOTH, expand=True, side=TOP)
    text.insert(END, "A\nMultiline\nMessage")

    for i in range(3, 100):
        text.insert(END, "line %d\n" % i)

    text2 = Text(frame)
    text2.pack(fill=BOTH, expand=True, side=TOP)

    for i in range(1, 200):
        text2.insert(END, "line %d\n" % i)

    bt1 = Button(frame, text="Bt#1")
    bt1.pack(side=LEFT)

    bt2 = Button(frame, text="Bt#2")
    bt2.pack(side=RIGHT)

    root.rowconfigure(2, weight=0)
    Label(root, text="Outer label").grid(row=2,
                                         column=0,
                                         columnspan=2,
                                         sticky="EW")

    if False:

        def event(e):
            print("event %r" % e)

        frame.bind("<Button-4>", event, "+")

    scrollable = set(["TCombobox", "Scrollbar", "Text"])

    def event_all(e):
        w = e.widget

        m = e.widget
        while m is not None:
            if m is frame:
                break
            m = m.master
        else:
            print("Outer widget")
            return

        cls = w.winfo_class()
        print("cls = " + cls)
        if cls in scrollable:
            return
        # scroll here

    bind_all_mouse_wheel(frame, event_all, "+")

    root.mainloop()