i made a paint program and i want it so that when you hit a key it starts recording and then you can see a screen recording of what you did, but if i use screenshots it will just be a bunch of .png files, how can i make a mp4 file or something like that
just as a recommend, how does it sound to make the event loop such as this,
for event in pygame.event.get(): if event.type == KEYDOWN: if event.key == [Key] elif event.ket == [Key] elif event.type == MOUSTBUTTONDOWN: if ... [Same prototype as top]
such that, it would be easier to group the KEYDOWN, KEYUP and other button signals and the code will be less self repeater since we would only write KEYDOWN for 1 time. Just a suggestion!
@deamon689: have been using while True instead of while 1 lately. But, I've just been doing it to back things clearer i my code. Why do you recommend doing it? does it make a difference?
@metalx1000 Its just a style issue that the designers of python prefer. Python didn't get bool statements till later on hence the use of 1 and 0, but Now we have True and False if makes things neater to keep up with the times.
@judasvigilante: PyGame works works with jpg and gif. PNG have an advantage over jpg because PNG has a transparent layer. Although, you can make a certian color transparent in JPEG files with Pygame.
i made a paint program and i want it so that when you hit a key it starts recording and then you can see a screen recording of what you did, but if i use screenshots it will just be a bunch of .png files, how can i make a mp4 file or something like that
maradona640 10 months ago
@maradona640: Although you should be able to do it with python itself, I don't know how.
but you can easily call something like FFMPEG or Mencoder from your python code.
here is an example:
ffmpeg -f image2 -i image%d.png video.mpg
metalx1000 10 months ago
just as a recommend, how does it sound to make the event loop such as this,
for event in pygame.event.get(): if event.type == KEYDOWN: if event.key == [Key] elif event.ket == [Key] elif event.type == MOUSTBUTTONDOWN: if ... [Same prototype as top]
such that, it would be easier to group the KEYDOWN, KEYUP and other button signals and the code will be less self repeater since we would only write KEYDOWN for 1 time. Just a suggestion!
himhim123 1 year ago
@himhim123: Yup, it's a good idea and some times I do that.
metalx1000 1 year ago
yesss! a fellow mint user!
JohnPortfolio2010 1 year ago
You should use while True, not while 1 :D
deamon689 1 year ago
@deamon689: have been using while True instead of while 1 lately. But, I've just been doing it to back things clearer i my code. Why do you recommend doing it? does it make a difference?
metalx1000 1 year ago
@metalx1000 Its just a style issue that the designers of python prefer. Python didn't get bool statements till later on hence the use of 1 and 0, but Now we have True and False if makes things neater to keep up with the times.
deamon689 1 year ago
Comment removed
deamon689 1 year ago
Another good tutorial!
why does pygame like .png files so much and not ther formats like .jpeg, .gif etc
judasvigilante 1 year ago
@judasvigilante: PyGame works works with jpg and gif. PNG have an advantage over jpg because PNG has a transparent layer. Although, you can make a certian color transparent in JPEG files with Pygame.
metalx1000 1 year ago
@metalx1000
Thanks for the prompt reply and for answe
ring my query, I get it now!
Great tutorials BTW.
Regards, paul
judasvigilante 1 year ago