Python Forum
Adding image to program on programiz.com
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding image to program on programiz.com
#1
class Person:
    name = " "
    stat = " "
    
person1 = Person()
person1.name = "Ross Kagawa"

def battingaverage():
    z = float(.200)
    homeruns = "0"
    rbis = "7"
    
#create object associate with name
person1.stat2 = ".200"
person1.stat1 = "0"
person1.stat = "7"

print(person1.name, "is a shitty baseball player.")
print("at Waimea High School in 1983.")
print("see yearbook, 1983.")

print("His baseball stat senior was: ")
print("batting average: ", person1.stat2)
print("homeruns: ", person1.stat1)
print("rbi's: ", person1.stat)

p = input()
print("He went on to UH Manoa baseball and play college ball for Hawai'i at 5-7 as a walk on.")
print("years played, 1985-1989")
Here's my stat. Quick fact on baseball. Put this on a canvas some where on the main page. Small square with a button. Press the button for game to game stat. Just update the current class file .py by saving the newer stat and discarding the older file. If it doesn't replace the old one. On the server. This file works.
Quote:Ross Kagawa is a shitty baseball player.
at Waimea High School in 1983.
see yearbook, 1983.
His baseball stat senior was:
batting average: .200
homeruns: 0
rbi's: 7
Why?
He went on to UH Manoa baseball and play college ball for Hawai'i at 5-7 as a walk on.
years played, 1985-1989

=== Code Execution Successful ===
Programs are like instructions or rules. Learning it gets us closer to a solution. Desired outcome. Computer talk.
Reply
#2
Can anyone explain this? I'd like to try this out. I'm reading it but do not know the codes or what it is.

Convert your image into Base64 and add this base64 string in your code. Convert back this string into image when needed. –
Muhammad Hashim Shafiq
May 12, 2018 at 19:05, stackoverflow
string = pygame.image.tostring(surface, 'RGB')
print(string) # A long bytes string (b'\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff\xff\x00\xff....')
That's the sample string code. The file name is pygame.py and image module and tostring() method.

Okay. I'm having trouble loading my file into my screen from online compiler programiz.com.
import image. (and some other file) #does it have to come from their directory? I got the pic file on my hard drive and picture folder

#I think i have the codes
import image
image = "UncleSam.jpg" #example image from pc

print(person2.name2) # object of the class file Person
Programs are like instructions or rules. Learning it gets us closer to a solution. Desired outcome. Computer talk.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020