Python Forum
[PyGame] Copying the Screen (PyGame)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Copying the Screen (PyGame)
#1
My code allows the user to create a drawing. later in the code I want to display that drawing. Is there any way that once the drawing is done I can copy the pygame display to use later, without saving the drawing to my computer. Like maybe saving it as a variable(any code available for this) :

Drawing = Whatever's on the pygame display

And later displaying that variable to the screen.
Is that possible???
Reply
#2
Do you mean as a screenshot-like or more like redrawing it automatically (loading it)?

(Feb-11-2017, 06:04 PM)Zman350x Wrote: without saving the drawing to my computer.
Either way it is going to have to be saved as an image, or data somewhere on the computer to recreate the drawing.
Recommended Tutorials:
Reply
#3
either one works but if I were to run my code ten times would I have 10 jpg or png files on my computer or would they override each other?
Reply
#4
They would only overwrite each other if you gave them the same file name. You would generally save them with different file names, and store those file names and what they are associated with in your program. If you need those file associations for different runs of the program, you would need to save them to file as well.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
ok perfect I want them to override. can someone show me the code

Never mind I figured it out
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  pygame full screen help corsasri 2 2,835 Mar-20-2024, 07:35 AM
Last Post: reginarodriguez
  [PyGame] When I hit the space bar from the home screen, it sends me to the game over screen JesusisKing 1 984 Apr-30-2023, 10:11 PM
Last Post: deanhystad
  [PyGame] Pygame : clearing a screen issue Reldaing 4 6,131 Jun-23-2020, 09:10 AM
Last Post: JudyLarose
  [PyGame] How to Display pygame on SSD1351 screen kalihotname 0 1,868 Nov-11-2019, 07:32 AM
Last Post: kalihotname
  [PyGame] pygame.draw.rect function stretches across the screen instead of moving BubblesTheGiraffe 2 3,646 Jun-11-2019, 08:32 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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