0

I'm working thru an example in Tkinter GUI Application Development Hotshot from Packt Pubs, using python 3.3 & tkinter 8.5 on Ubuntu 13.10.

Here is a small relevant portion of the code I'm having problems with:

import tkinter as tk

<snip>

def on_find():
    t2 = tk.Toplevel(root)
    t2.geometry('262x65+200+250')
    t2.transient(root)
    tk.Label(t2, text="Find all: ").grid(row=0, column=0, sticky='e')
    v = tk.StringVar()
    e = tk.Entry(t2, width=25, textvariable=v)
    e.grid(row=0, column=1, padx=2, pady=2, sticky='we')
    e.focus_set()
    c = tk.IntVar()
    tk.Checkbutton(t2, text='Ignore case', variable=c).grid(row=1, column=1, sticky='e', padx=2, pady=2)
    tk.Button(t2, text='Find all', underline=0, command=lambda: search_for(v.get(),     c.get(), textPad, t2, e)).grid(row=2, column=1, sticky='e+w', padx=2, pady=2)

<snip>

Specifically, I'm having problems with the Button widget in the last line. It's not showing up in the popup window at all. The Label, the Text box, the Checkbutton - all there. Just not the Button, and I'm not really sure why.

1
  • Maybe you have error in Button definiton. Do you get error message (trackback) in terminal ? Commented Nov 25, 2013 at 3:33

1 Answer 1

1

You have two errors:

  • in Checkbutton: it should be sticky in place of ticky
  • in Button: it should be 'ew' in place 'e+w'

Next time run program in terminal to get error message (trackback)

Sign up to request clarification or add additional context in comments.

1 Comment

The 'ticky' was a typo... but the 'ew' did the trick. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.