0

So I have constructed a simple tkinter application in which text gets updated every few seconds, but I am unable to add to background image to it.

import tkinter as tk
import requests

def updateText():
    r = requests.get('https://***')
    data = r.json()
    newText = str(data["Number"]["title"])
    textWidget.delete(1.0, tk.END)
    textWidget.insert(tk.END, f"{newText}") 
    root.after(10000, updateText)
     
root = tk.Tk()

textWidget = tk.Text(root)

textWidget.pack()
textWidget.configure(font=("Arial",24))

updateText()

root.mainloop()

The background image is as follow enter image description here

So I want text to appear where in the image where is says so, but so far i am unable to get the desired result. Is there a way to achieve the desired result

1 Answers1

0

The Text widget doesn't support background images. There's no way to do what you want. The only way to get a background image along with text is to use a Canvas widget with image and text items on it.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685