Python Forum
drawing textvariable from Button inside canvas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
drawing textvariable from Button inside canvas
#7
There was an option I was missing: lift().

I did this code and it works:

        gun_1 = tk.Button(self, borderwidth=0,bg='black',fg='yellow',disabledforeground='yellow',state=tk.DISABLED,textvariable=self.gun, highlightcolor = 'yellow')
        self.canvasgun1 = tk.Canvas(self, width=28, height=28, bg='black', highlightthickness=0)
        self.canvasgun1.grid(row=0, column=0)
        self.canvasgun1.create_oval(0,0,27,27,outline='yellow')
        gun_1.lift()
        gun_2 = tk.Button(self, borderwidth=0,bg='black',fg='yellow',disabledforeground='yellow',state=tk.DISABLED,textvariable=self.gun)
        self.canvasgun2 = tk.Canvas(self, width=28, height=28, bg='black', highlightthickness=0)
        self.canvasgun2.grid(row=0, column=7)
        self.canvasgun2.create_oval(0,0,27,27,outline='yellow')
        gun_2.lift()
Apparently you have to lift the button on top of the canvas as until you initiate that command set, it will stay in the back ground.
Reply


Messages In This Thread
RE: drawing textvariable from Button inside canvas - by knoxvilles_joker - Apr-25-2021, 10:49 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020