473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to display images on click via Python

Hello, so I have this thing I'm making and where every time you click on a screen a new gif pops out. However, when I run it nothing appears on the new screen when I click.

This is what I have so far
Expand|Select|Wrap|Line Numbers
  1. import glob
  2. ypos = 0
  3. xpos = 0
  4. robotArmy = []
  5.  
  6. def setup():
  7.     global ypos
  8.     size(700,700)
  9.     ypos = height * 0.25
  10.     frameRate(12)
  11.     global animation1
  12.     animation1 = robots("./RobotGIF/robotprojects-",15) #ref from animatedspriteclass
  13.  
  14. def draw():
  15.     background(255)
  16.  
  17. class robots:
  18.     def __init__(self,imagePrefix,c): #from animatedSpriteClass
  19.         self.imageCount = c
  20.         self.images = []
  21.         self.frame = 0
  22.         print self.imageCount
  23.         for i in range(self.imageCount):
  24.             filename = imagePrefix + nf(i, 4) + ".gif"
  25.             self.images.append( loadImage(filename) )
  26.  
  27.     def draw(self,x,y): #ref animatedspriteclass
  28.         self.frame = (self.frame+1) % self.imageCount
  29.         image(self.images[self.frame], x, y)
  30.  
  31.     def getWidth(self):       
  32.         return self.images[0].width
  33.  
  34. def mousePressed():
  35.     robotArmy.append(animation1)
  36.  
  37.  
  38.  
  39.  
  40.  
Dec 17 '16 #1
1 1513
dwblas
626 Expert 512MB
You have to use a program that displays images in order to see them on the screen. Like one of the GUI tookits or GIMP, or even a browser, etc. Also there is no screen to click on in the code you posted nor any callback for a screen click. You should be getting an error message on the following line because there is no function named image in the code.
Expand|Select|Wrap|Line Numbers
  1. image(self.images[self.frame], x, y) 
Dec 17 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Edwinah63 | last post by:
Hi Everyone, All the very best for 2004!! i need urgent help with this problem, the users are about to skin me alive!! we have an access front end with linked to sql server 2k tables. ...
1
by: Jenny | last post by:
Need urgent help for an unsolved problem. In our ASP web application, we creat a Back button and if user click on this button, it execute history.go(-1) to go back to the previous page. All our...
8
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for...
6
by: varkey.mathew | last post by:
Dear all, Bear with me, a poor newbie(atleast in AD).. I have to authenticate a user ID and password for a user as a valid Active Directory user or not. I have created the IsAuthenticated...
7
by: zeyais | last post by:
Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc} </style> <body> <div class="leftcolumn"...
0
by: bprasanth_20 | last post by:
Hi, I need an urgent help. I need to create a UDF (User Defined Function) in DB2 SQL which can accept any number of arguments (from 2 to 5 arguments). I do not how to achieve this. When I pass 2...
1
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
1
by: Domini | last post by:
Hi all, I need urgent help with an xml issue. Let me explain the scenario: My VB.NET app needs to read an xml (e.g. Sales Orders). This xml contains say 10 sales orders. Next the app needs to split...
0
by: Christopher | last post by:
Urgent Help Needed: The EPVH-1.1 Visual Hull Library. Dear All, I am a student doing research in computer vision. The EPVH-1.1 Visual Hull Library will really help a lot in my research. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.