Questions tagged [photoimage]
104 questions
0
votes
2 answers
Using a generated image in a tkinter GUI with PIL
I am trying to use a tkinter button to display a ERD diagram using sqlalchemy and PIL.
I have managed to get this to work by saving the picture generated to a file and then re-opening that file in order to display in a label.
Is there a way to get…

KGoed
- 27
- 3
0
votes
0 answers
Tkinter PhotoImage Error: couldn't recognize data in image file
I am working on winows 7 and python 3.8.2. I have an error.
I wanted to upload an Image in a tkinter window. I tried importing a .gif file and I get an error as
"couldn't recognize data in image file". Though the file is in the correct path the…

math scat
- 310
- 8
- 17
0
votes
1 answer
Why the the image isn't displayed on the canvas? [Python3 + tkinter]
I've been programming an application using tkinter and python 3. I've created a canvas and I'm tring to display on it a gif image of 5000x5000 pixel, where the canvas is 2000x2000 pixel, but the image doesn't appear when the program is being ran.…

Luke__
- 227
- 1
- 9
0
votes
0 answers
tkinter: can't align text to the left on image label
I'm trying to align the text to the top left (using tkinter only). Nothing I tried works so far (anchor, pack, grid with sticky 'w') and I can't understand why. I'm working with several classes, and the label is within a frame defined as its parent.…

lir0ni
- 1
- 1
0
votes
1 answer
How do I place sentence on the top?
I'm trying to place sentence (welcome currency converter) on the top, but can't success.
import tkinter as tk
my_window = tk.Tk()
photo = tk.PhotoImage(file='currency conventer.png')
background_window = tk.Label(my_window,
…

Lisa Jao
- 5
- 1
0
votes
1 answer
tk.PhotoImage couldn`t open "gif"
I have strange behavior of the below code.
When I run this code from PyCharm level it works properly and return this window (including gif with Python logo!):
Window with Python logo
When I run the same python code but with using .bat and .vbs…

Swift S1
- 15
- 4
0
votes
1 answer
Error while converting PIL image to Tkinter image
I'm trying to rotate an image using Pillow:
img = Image.open("./assets/aircraftCarrier/aircraftCarrier0.gif")
img = img.rotate(270)
This rotates the image but when I try to save it Pillow doesn't seem to recognise the file type, even if I put the…

Joshlucpoll
- 189
- 3
- 12
0
votes
0 answers
I am trying to import an image for one part of my code but it is not displaying, however it is displaying further on in a different section
Code not displaying the image
home = PhotoImage(file = 'homebutton.png')
Button(hotfood, image = home, bg = 'white', command =
hotfood.destroy).grid(row = 0, column = 0, sticky = EW)
return home
Code displaying image
logo = PhotoImage(file =…

Carlos Rojas
- 1
- 1
0
votes
1 answer
Cannot zoom tkinter PhotoImage: _tkinter.TclError: not enough free memory for image buffer
I have a canvas that has a width of w and a height of h. I'm trying to fit my (1000 x 800) image on it using image = image.zoom(w).subsample(800). But it's giving me the error: _tkinter.TclError: not enough free memory for image buffer. Can someone…

Jacob
- 225
- 1
- 9
0
votes
1 answer
In Tkinter how do you use canvas inside a defintion?
In the code that i recently wrote in python3.3, I am trying to create a fruit machine and am in the early stages. It appears that as soon as i use the "help" button, "ianh.gif" doesn't display.
from tkinter import *
def help(event):
global…
0
votes
1 answer
Canvas won't show a PhotoImage pic if the code is in a method
New to python and so far mostly love it but this issue is odd. The exact same code works from the root but not in a method.
This does not render the image:
from tkinter import *
root = Tk()
def draw():
print("does not work")
canvas =…

DKnight
- 1
- 1
0
votes
0 answers
Tkinter Photoimage halts self.after()
My objective is to have a looping background image set, functioning exactly the way a .gif does, and on top of that, to have a slideshow of images loop concurrently with a delay of about 1 second.
Originally, when my slideshow was only 150-200…

suscat
- 61
- 8
0
votes
0 answers
Changing tk.Label image with OptionMenu event
I've searched for an answer but it seems that no one has had this issue before.
I don't know what I am missing. Here's a simplified version of the code, with the same problem:
app = tk.Tk()
location = 'C:\\Users\\User\\Desktop'
image = location…

Gonçalo
- 13
- 4
0
votes
2 answers
Decode Base64 after it has been saved as a string object?
I am fairly new to Python and am attempting to compile a text (.txt) document that acts as a save file and can be loaded later.
I would like it to be a standalone document that holds all attributes the user is working with (including some images…

Torvoor
- 57
- 1
- 5
0
votes
1 answer
Tkinter: Buttons can't be added on resizable PhotoImage
Buttons can't be added on resizable image label in Tkinter. I am trying to add a resizable image that is easily showing up. Also, I am trying to add buttons on the top of it which seems to me as an issue.
Here's the code:
from tkinter import *
from…

Shubh Saxena
- 13
- 3