Reputation: 65
I have managed to create this.
I am using an oval with a different shade to create this.
def Banner():
canvas.create_oval(-300, 1600, 4000, 200, fill="gray38", outline="gray38", width=4)
banner_label = Label (canvas, width=30, height=2, font=font3, text = "FITNESS FIRST", bg="gray30", fg = "white")
canvas_banner_label = canvas.create_window(500, 200, window=banner_label)
However i was wondering if theres anyway i could get the oval to almost take priority, and overlap the Label so that the oval is in front of it, allowing the pattern to be visible all the way through
Upvotes: 1
Views: 564
Reputation: 15226
The problem with using Label()
on the canvas is the label itself has its own background and will always be at the same level as the text so you cannot overlap your canvas image behind the text. However canvas has a method called create_text
that will draw the text directly on the canvas instead of using a label.
Here is an example using create_text
for canvas.
In the create_text
method the first 2 arguments are coordinates then all you need is the text font and fill is the color.
import tkinter as tk
root = tk.Tk()
canvas = tk.Canvas(root, width=800, height=650, bg="darkgrey")
canvas.create_oval(-300, 1600, 4000, 200, fill="gray38", outline="gray38", width=4)
canvas.create_text(400,325, text="FITNESS FIRST", font=("Purisa", 60),fill="white")
canvas.pack()
root.mainloop()
Results:
Upvotes: 1