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

PostgreSQL procedural languages: to choose?
Does Django support multi-value cookies?
Doing CRUD in Turbogears
Using property() on classmethods
Should Python import statements always be at the top of a module?
What's the best way to upgrade from Django 0.96 to 1.0?
phpMyAdmin equivalent in python?
Most used Python module for video processing?
Efficient method to determine location on a grid(array)
Python exception backtrace tells me where line ends, where does it begin?
Search directory in SVN for files with specific file extension and copy to another folder?
Is it possible for a running python program to overwrite itself?
Ensuring subprocesses are dead on exiting Python program
Send file using POST from a Python script
How to copy a file to a remote server in Python using SCP or SSH?
Change command Method for Tkinter Button in Python

Categories

HOME
xbox-live
tensorflow
dynamics-crm
jar
drupal-7
firebase-app-indexing
steam
visualization
command
concourse
bibtex
flyway
yocto
httpclient
deeplearning4j
lotus-notes
click
cortex-a
onsen-ui2
scenebuilder
saiku
aptana
atlassian-plugin-sdk
ios10.3
esql
url.action
hhvm
onsen-ui
memsql
samsung-mobile
image-quality
metadata-extractor
web-frontend
frp
reply
weinre
devforce
vegan
encase
outsystems
pljson
body-parser
rhomobile
boilerplate
nlb
sql-like
initializer
delphi-10.1-berlin
brute-force
parent
restful-url
intellilock
android-maps-v2
tuleap
appstore-approval
gauss
goquery
spell-checking
maintenance
etherpad
httplib2
infinite-scroll
festival
rsqlite
master
gradle-script-kotlin
ebtables
c64
tomee
mongoose-populate
webkit2
dojox.charting
coordinate-transformation
freefem++
qt-linguist
eml
handlebars.java
java.util.calendar
ninject.web.mvc
wikitext
retro-computing
base32
uptodate
musl
grunt-contrib-concat
hidden-field
docopt
ember-addon
cppdepend
alertifyjs
openkinect
leptonica
multiple-login
ienumerator
ng-pattern
icsharpcode
css-tables
moq-3
shim
getstring
isolatedstorage
curljs
ihttphandler
symbol-server
gwt-2.2-celltable
data-entry
web-analytics-tools
database-diagramming

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