原始 MediaWiki 页面

我知道编辑这个网站吗?

延迟快照

自迁移出 MediaWiki 以来,本页内容尚未经过审查。如果您愿意帮忙,请查看帮助指南

目的

就简单了:打开一个对话框询问时间延迟这么长时间(以秒为单位)。

经过这样的延迟后,就会截取桌面的屏幕截图。

该片由编剧阿尔伯特·卡多纳 (Albert Cardona) 维护。

##代码

# Take a snapshot after a delay specified in a dialog
# 
# The plugin has to fork, which is done by:
# 1 - declaring a function to do the work, 'snasphot'
# 2 - invoking the function via thread.start_new_thread,
#     which runs it in a separate thread.


import thread
import time

def snapshot(delay):
   time.sleep(delay)
   IJ.doCommand('Capture Screen ')

gd = GenericDialog('Delay')
gd.addSlider('Delay (secs.): ', 0, 20, 5)
gd.showDialog()

if not gd.wasCanceled():
    # the 'extra' comma signals tuple, a kind of list in python.
    thread.start_new_thread(snapshot, (int(gd.getNextNumber()),))

另请参阅

Jython Scripting