0

I've been working on a cookie clicker program which includes a progress Bar widget. The progress bar is working perfectly, however when I run my program, the progress bar is surrounded by an ugly grey border.I have tried using highlightbackground but that does nothing. I am working on Mac OSX.

Here's an image of the progress bar when the program is run: https://i.stack.imgur.com/Y7Tue.png

Here is my code:

from Tkinter import *
from Tkinter import Canvas
import ttk
window1 = Tk()
window1.title("Cookie Clicker")
window1.config(background="dodger blue")
window1.geometry("254x370")
clicks = 0


def cookie_clicks():
    global clicks
    clicks = clicks + 1
    pb.step(1)
    print("{0}".format(clicks))
    if clicks == 1:
        lbl1.configure(text="{0} Cookie!".format(clicks))
    else:
        lbl1.configure(text="{0} Cookies!".format(clicks))


cookie = Button(window1, highlightbackground="dodger blue", borderwidth=0, cursor="hand2", command=cookie_clicks)
photo = PhotoImage(file="imageedit_3_3213999137.gif")
cookie.config(image=photo, width="250", height="250")
cookie.place(x=0, y=90)
w = Canvas(window1, width=254, height=80, highlightbackground="gray")
w.pack()
w.create_rectangle(10, 10, 80, 80, outline="gray", fill="gray", width=100000)
w2 = Canvas(window1, width=0.1, height=250, highlightbackground="dodger blue")
w2.place(x=0, y=85)
w3 = Canvas(window1, width=0.1, height=250, highlightbackground="dodger blue")
w3.place(x=249, y=85)
w4 = Canvas(window1, width=250, height=0.1, highlightbackground="dodger blue")
w4.place(x=0, y=88)
w5 = Canvas(window1, width=250, height=0.1, highlightbackground="dodger blue")
w5.place(x=0, y=338)
lbl1 = Label(window1, bg="gray", fg="dodger blue", text="{0} Cookies!".format(clicks), font=("kavoon", 20))
lbl1.place(x=75, y=40)
lbl2 = Label(window1, bg="gray", fg="dodger blue", text="Cookie Clicker", font=("kavoon", 30))
lbl2.place(x=20, y=0)
pb = ttk.Progressbar(window1, orient='horizontal', mode='determinate')
pb.place(x=76, y=68)

window1.mainloop()

Any help would be appreciated!

  • 1
    Unrelated to your question, but I'd advise you to stop using the `place` geometry manager. Your GUI looks absolutely horrible on my PC because nothing is placed correctly. – Aran-Fey Apr 03 '18 at 21:03
  • Yes. Your GUI is a mess on my end as well. I would suggest you use `grid()` instead. – Mike - SMT Apr 03 '18 at 21:07
  • 1
    The progress bar is a ttk (themed) widget. Try [this link](https://stackoverflow.com/questions/13510882/how-to-change-ttk-progressbar-color-in-python) to see how you might go about achieving the look and feel you desire. – Ron Norris Apr 04 '18 at 01:57

0 Answers0