python


why my image is moved instead of creating multiple images


I'm trying to show the same image on a few locations on my newly opened window using this:
root = tkinter.Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
for i in range(len(entities) + 1):
img = ImageTk.PhotoImage(Image.open(path))
panel = tkinter.Label(root, image = img)
panel.grid(row = i, column = i)
This indeed displays the first image, but only moves it around, instead of creating new images. How can I fix that?
found it!
I used a list instead, to store the images and then treat each one separately by changing my code to:
entity_images = []
for i in range(len(entities)):
img = ImageTk.PhotoImage(Image.open(path))
entity_images.append(img)
panel = tkinter.Label(root, image = entity_images[i])
panel.grid(row = i, column = i)

Related Links

installing PyQt 5 on windows 7 with python 3.4
django powered website switches between logged in users
Using conda install within a python script
How to create a memory-mapped file in Python that is accessible from a called application?
Sorting and indexing between 2 numpy arrays
How to catch Exception and still proceed on with the task?
how to use dir() as default argument within a function [duplicate]
Python clear button
pyspark assigning name to column agg output [duplicate]
Python subclass interact to master class
Combining different names in a database
Insert into mysql python - not working
How to specify conda requirement file?
Pip installs old version of package
Python Tkinter coordinate canvas error
How can I implement vice versa mapping in Python?

Categories

HOME
filterrific
amazon-swf
json-ld
vlc
appmaker
ll
rebol
docker-windows
internet-explorer-11
subquery
unity2d
game-maker-studio-1.4
activesync
symfony2-easyadmin
session-timeout
tree-traversal
flat-file
jni
apply
header-files
bootstrap-typeahead
badge
samsung-mobile
printdocument
switching
jenkins-job-dsl
rhandsontable
cgal
receipt
mapguide
remote-server
s3cmd
polyfills
android-maps-v2
upsert
chown
dimple.js
gauss
goquery
openh264
tcserver
sqldatareader
barcode-printing
typhoon
c64
ruby-2.0
django-filer
asteriskami
gherkin
multinomial
hateoas
android-cursoradapter
file-diffs
sourcegear-vault
ipojo
ffserver
gray-code
musl
alpha-transparency
proxies
level
picat
delphi-xe3
dvcs
jstack
confusion-matrix
nservicebus4
leptonica
mstsc
iconv
xslkey
database-permissions
magickwand
attachevent
supersized
entity-framework-ctp5
hinstance
easygui
associative
squeel
front-controller
code-design
scatterview
revision
msf
cots

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App