From 9f185be2bc6b2bd8d80e260f361ad29f15c68032 Mon Sep 17 00:00:00 2001 From: prcrst Date: Thu, 16 Dec 2010 11:26:33 +0100 Subject: [PATCH] No need to actually initialize pygame, make parameters in filename optional --- longneck.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/longneck.py b/longneck.py index dbb4d2c..cd0efa1 100755 --- a/longneck.py +++ b/longneck.py @@ -38,9 +38,12 @@ parser.add_option("-f", "--file", default="longneck.png", help="write to this file, default: longneck.png") -(options, args) = parser.parse_args() +parser.add_option("-p", "--params", + dest="params", + action="store_true", + help="out used parameters int the output filename") -pygame.init() +(options, args) = parser.parse_args() width, height = max(330, options.width), max(370, options.height) @@ -73,4 +76,7 @@ else: out_surface = target parts = options.file.split('.') -pygame.image.save(out_surface, '.'.join(parts[:-1] + [suffix, parts[-1]])) +if options.params: + options.file = '.'.join(parts[:-1] + [suffix, parts[-1]]) + +pygame.image.save(out_surface, options.file) -- 2.11.4.GIT