mirror of https://github.com/kivy/kivy.git
core:Window improve screenshot method, closes #1455
This commit is contained in:
parent
28e726520b
commit
61ff0febd4
|
@ -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,8 +923,8 @@ 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue