From 61ff0febd4b83330f36dd59f5f94a03e1f46e83b Mon Sep 17 00:00:00 2001 From: qua-non Date: Sun, 15 Dec 2013 06:09:30 +0530 Subject: [PATCH] core:Window improve screenshot method, closes #1455 --- kivy/core/window/__init__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kivy/core/window/__init__.py b/kivy/core/window/__init__.py index b77cbde9a..94e3ea104 100755 --- a/kivy/core/window/__init__.py +++ b/kivy/core/window/__init__.py @@ -733,14 +733,17 @@ class WindowBase(EventDispatcher): elif key == 'center_y': w.center_y = value * height - def screenshot(self, name='screenshot%(counter)04d.png'): + def screenshot(self, name='screenshot{:04d}.png'): '''Save the actual displayed image in a file ''' i = 0 path = None + if name != 'screenshot{:04d}.png': + _ext = name.split('.')[-1] + name = ''.join((name[:-(len(_ext) + 1)], '{:04d}.', _ext)) while True: i += 1 - path = join(getcwd(), name % {'counter': i}) + path = join(getcwd(), name.format(i)) if not exists(path): break return path @@ -920,9 +923,9 @@ class WindowBase(EventDispatcher): target attached if you're using the keyboard in a multi user mode. `input_type`: string - Choose the type of soft keyboard to request. Can be one of 'text', - 'number', 'url', 'mail', 'datetime', 'tel', 'address'. - + Choose the type of soft keyboard to request. Can be one of + 'text', 'number', 'url', 'mail', 'datetime', 'tel', 'address'. + .. versionadded:: 1.8.0 :Return: