1

My Button is not appearing in tkinker (Python).
Here is the main Code:

# Start Of Manual Scanner ------------------------------------
manual = LabelFrame(tab_1,
                    text="Manual")
manual.pack(side=LEFT)
main = Label(manual,
             text="Manual Entry",
             font=('Arial', 20))
main.pack(side=TOP)
manual_entry = Entry(manual,
                     width=100,
                     font=('Arial', 20))
manual_entry.pack(side=RIGHT)
place_order_BTN = Button(manual,
                         text="Add Item",
                         fg='black',
                         font=('Arial', 20),
                         width=20,
                         bg='#feffa3',
                         activeforeground='white',
                         activebackground='black',)
place_order_BTN.pack(pady=15)

When I run it:

screenshot of entire window

martineau
  • 119,623
  • 25
  • 170
  • 301
JazzTGB145
  • 19
  • 4
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 20 '21 at 18:45
  • 2
    I could not reproduce the problem replacing `tab_1` with the root `Tk()` window. It looks like you may be using a `ttk.Notebook` which may have something to do with the problem. Please provide [mre], as there is not enough information in the snippet of code currently in your question. – martineau Oct 20 '21 at 19:00
  • The entry `manual_entry` is too long (100 characters width) and so the button is squished to zero width. Try changing `manual_entry.pack(side=RIGHT)` to `manual_entry.pack()`. – acw1668 Oct 21 '21 at 01:09

1 Answers1

0

The button is actually packed to the left of the entry. However since the entry is a bit long (100 characters width), it squishes the button to zero width.

You can either make the entry a bit smaller:

manual_entry = Entry(manual,
                     width=30,  # changed from 100 to 30
                     font=('Arial', 20))
manual_entry.pack(side=RIGHT)

enter image description here

or changing manual_entry.pack(side=RIGHT) to manual_entry.pack().

enter image description here

acw1668
  • 40,144
  • 5
  • 22
  • 34