示例#1
0
def main():
    with Display():
        with EasyProcess('zenity --question') as p:
            p.sleep(1)

            img = grab()
            rectangles = discover_buttons()
            print( rectangles )

    img = draw_indexed_rect_list(img, rectangles)
    img = autocrop(img)

    # display results
    img.show()
示例#2
0
def check_buttons(cmd, expect):
    with SmartDisplay(visible=VISIBLE) as disp:
        with EasyProcess(cmd):
            disp.waitgrab(timeout=TIMEOUT)
            buttons = discover_buttons()

            eq_(len(buttons), len(expect), 
                msg='dialog does not have expected buttons %s!=%s' % (buttons,expect))
            
            mouse = PyMouse()
            print 'buttons:',buttons
            for v, b in zip(expect, buttons):
                process = EasyProcess(cmd).start().sleep(1)
                mouse.click(*b.center)
                process.wait()
                eq_(process.stdout, str(v)) #dialog does not return expected value
示例#3
0
def click_button_get_return_code(which_button):
    with EasyProcess('zenity --question') as p:
        time.sleep(1)
        rectangles = discover_buttons()
        PyMouse().click(*rectangles[which_button].center)
        return p.wait().return_code
示例#4
0
def test_zenity():
    with SmartDisplay(visible=0) as d:
        with EasyProcess('zenity --warning') as p:
            d.waitgrab()
            ls = discover_buttons()
            eq_(len(ls), 1)
示例#5
0
def test_gmessage():
    with SmartDisplay(visible=0) as d:
        with EasyProcess('gmessage -buttons x,y,z hi') as p:
            d.waitgrab()
            ls = discover_buttons()
            eq_(len(ls), 3)
示例#6
0
文件: basic.py 项目: ponty/discogui
def main():
    with Display(visible=0):
        with EasyProcess('zenity --question') as p:
            p.sleep(5)
            buttons = discover_buttons()
    print( buttons )