Questions tagged [photoimage]
104 questions
0
votes
0 answers
Tkinter Python PhotoImage appears as tiny square on button and can not be seen
I am so new to python. I am trying to implement a program which changes a button's image property with an "on click" operation. I have tried png, jpeg, gif and bmp formats. I don't want to use PIL, I just want to handle it with tkinter. When I click…

BCZ
- 1
0
votes
0 answers
Adding Image as Background in tkinter Window with X- and Y- Scrollbars
I am working on a Python 3 tkinter app that uses windows with vertical and horizontal (mouse-scrollable) scrollbars along the window's dimensions. But I am unable to display a .png image as the background on the same windows.
I've gone through the…

Я J K
- 1
- 1
0
votes
1 answer
Do tkinter's PhotoImages really require a root window? Why?
I'm trying to create a small class to represent vital information about various GIFs that I want the software to handle. Here's my code:
from PIL import Image
import tkinter as tk
class ListifiedGif:
"""Class containing list of frames and…

MattFunke
- 33
- 5
0
votes
1 answer
TypeError: 'PhotoImage' object is not callable - Python Tkinter
So I have been trying to build a simple text editor with tkinter but unfortunately when I use the open() function in Python to open a specific file, an error shows up, saying 'TypeError: 'PhotoImage' object is not callable' on line 83. How is this…

SmolPythonGuy
- 33
- 6
0
votes
0 answers
Exception has occured OSError for Python Tkinter background image
I am trying to use a picture as my background in my Tkinter window but every time I try to load the image it keeps giving me this error:
Invalid argument: ':\\Users\\name\\OneDrive\\Pictures\\coins.png'
Before that I was getting a Unicode error…

Qi'ra
- 37
- 6
0
votes
1 answer
Change filepath of an image using command
I have written some code which takes a date of birth and calculates the correct Chinese horoscope animal (rat, dog etc.). I would like to add a gui whereby, when the user hits calculate, the gui shows a photo of the appropriate animal. To do that I…

Andrew Gardner
- 21
- 2
0
votes
2 answers
I was creating a image with PhotoImage and this error happened
***Error message :
Traceback (most recent call last):
File "C:/Users/gurse/Desktop/Khanda/Khanda.py", line 3, in
label = Label(x, image=PhotoImage(file=r"C:\Users\gurse\Desktop\Khanda"))
File…

Google
- 1
0
votes
1 answer
Can't reuse variable assigned with tkinter.PhotoImage
I'm trying to loop through a dictionary that contains the names of icons that I want to add to a tkinter Menu object. Here's a snippet of the code:
token_menu = Menu(menubar, tearoff=0)
menubar.add_cascade(label="Tokens",
…

ajgringo619
- 131
- 2
- 8
0
votes
1 answer
How to display an image in a specific tkinter window using PhotoImage?
I have two running tkinter windows but I want only one specific window to display the image but I am not able to achieve this. I tried to specify the master in the Label statement but python shows an error which says "image pyimage1 doesn't…

Bitopan
- 3
- 3
0
votes
0 answers
How do i use an image as a button function (Tkinter)
Original Code:
search_button = Button(Frame3, text="Search", command=lambda: displaySelected(), bg="black", fg="white", font=('Arial', 10),padx=5,pady=5)
search_button.place(x=210, y=190)
How Original Output is like:
Click to view for better…

Fumin
- 33
- 7
0
votes
4 answers
TypeError: 'Function' missing one required positional argument: 'self'
Code:
class App:
root = Tk()
button1 = Button()
button2 = Button()
button3 = Button()
img1 = PhotoImage(file="blueBox.png")
img2 = PhotoImage(file="redBox.png")
deckImage = PhotoImage(file="blackBox.png")
The Error…

EleckTroniiKz
- 1
- 3
0
votes
1 answer
Tkinter Background Image not showing up
I am trying to create a weather App in Tkinter GUI. It is working fine. I want to add a background image to it but it wont show up. initially i did it without the reference line but it didnt work. On some website they said to keep reference of the…
user10482454
0
votes
2 answers
Tkinter won't update image file to one in a new directory
I'm trying to create a button with an image icon on top of it which should switch icons to an image specified in a function the button calls when its clicked. The button however just stays as it is with the original image when hit with no error…

tristanxvp
- 3
- 1
0
votes
0 answers
Click to select new image for button - not working
I am trying to create a function for multiple buttons that allows the user to click on a specific button and change the associated image. For now I'm trying to change the image of a single button, but the image doesn't seem to be loaded or…

Wes Tomer
- 319
- 1
- 13
0
votes
1 answer
Image not showing up when file updated/changed Tkinter
I have an image that I have placed, which works perfectly fine, but when I want to change it to a different image it doesn't change. The cards images have the same names as the ones in the list, i.e. 2C = 2 of…

Sam H
- 118
- 11