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

How to get tcp raw data in pox
aiohttp and client-side SSL certificates
Django admin page 404
# -*- coding: utf-8 -*- in __init__.py [duplicate]
Python - Download Images from a list of urls in a csv and rename images from custom list
Matplotlib customize pie chart labels and dropshadow
Seaborn - Why import as sns?
Renaming the Columns in Self-Join of data frame in Spark
How to upload image using ckeditor in django?
Implementing Django style API, chaining dots, inheritance
Python ~ Getting first few numbers from left to right
Error installing twisted on windows 10. INCLUDE environment variable is empty
How to implement “circular” generator in Python?
telegram bot. Forward message to another chat
Pyspark aggregation using groupBy is very slow compared to Scala
Multiple delimiters in single CSV file

Categories

HOME
security
google-cloud-bigtable
tinyos
vb6
ubuntu-16.04
memory-leaks
amazon-product-api
transparent
iso
wordpress-theming
jboss7.x
game-physics
maxima
aspell
yeoman-generator
chocolatey
propel2
ios10.3
excel-2010
esql
spring-ws
binutils
source-maps
shopping-cart
opencart2.3
cgal
mayavi
pitest
invoke-command
pari
backup-strategies
skygear
pyscripter
m2e
polymorphism
reactivemongo
large-data
sidr
nlb
wfp
bigcartel
rule
wcf-security
ddms
control-flow-graph
cppunit
proof
walmart-electrode
appstore-approval
gce
static-code-analysis
unity3d-editor
inject
packagemaker
picasa
debugdiag
soda
ng2-material
altbeacon
test-class
getrusage
hyperthreading
sourcegear-vault
evo
sem
harp
ytplayerview
cpu-cores
epl
ctrlp
ejabberd-saas
proximity
rhel5
errorprovider
planetary.js
sgml
broadcasting
bfd
bigint
iconv
qss
snapjs
domain-calculus
wcf-web-api
point-sprites
flexicious
path-manipulation
serp
charts4j
scalaxb
out-of-browser
recordset
idictionary
rtsp-client
plinq
microsoft.ink
opcodes
system-codedom-compiler

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