当前位置: 首页>>代码示例>>Python>>正文


Python pyautogui.size函数代码示例

本文整理汇总了Python中pyautogui.size函数的典型用法代码示例。如果您正苦于以下问题:Python size函数的具体用法?Python size怎么用?Python size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了size函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: expose

    def expose(self,widget,event):
        cr = widget.window.cairo_create()
        cr.set_operator(cairo.OPERATOR_CLEAR)
        # Makes the mask fill the entire window
        cr.rectangle(0.0, 0.0, pyautogui.size()[0],pyautogui.size()[1])
        # Deletes everything in the window (since the compositing operator is clear and mask fills the entire window
        cr.fill()

        cr.set_operator(cairo.OPERATOR_OVER)

        cr.set_source_rgb(1,1,1)
        cr.set_line_width(5)
        if self.droites!=None:
            for droite in self.droites:
                angle = droite[0]*math.pi/180
                x2=droite[1]
                y2=droite[2]
                if x2!=0:
                    y= math.tan(angle)*(0-x2)+y2
                    cr.move_to(0,y)
                    cr.line_to(x2,y2)
                    cr.stroke()
                else:
                    y= math.tan(angle)*(pyautogui.size()[0]-x2)+y2
                    cr.move_to(pyautogui.size()[0],y)
                    cr.line_to(x2,y2)
                    cr.stroke()

        if self.position!=None:
            cr.set_source_rgb(0,0,1)
            cr.arc(self.position[0], self.position[1],
                   15,0,math.pi*2)
            cr.fill()
开发者ID:bsamel,项目名称:awesome_pi,代码行数:33,代码来源:affichageDroite.py

示例2: __init__

 def __init__(self):
     self.lock=RLock()
     self.droites=[]
     self.win = gtk.Window()
     self.win.fullscreen()
     self.win.set_app_paintable(True)
     self.drawing_area = gtk.DrawingArea()
     vbox=gtk.VBox()
     self.win.add(vbox)
     vbox.add(self.drawing_area)
     btn=gtk.Button("quit")
     erase=gtk.Button("erase")
     hbox=gtk.HBox()
     hbox.show()
     vbox.add(hbox)
     vbox.show()
     hbox.add(btn)
     hbox.add(erase)
     btn.show()
     erase.show()
     self.drawing_area.set_size_request(pyautogui.size()[0],pyautogui.size()[1]-50)
     self.drawing_area.connect("expose-event", self.expose)
     self.drawing_area.show()
     self.win.show()
     btn.connect("clicked",self.quit)
     erase.connect("clicked",self.erase)
开发者ID:bsamel,项目名称:awesome_pi,代码行数:26,代码来源:PrNoteDefault.py

示例3: on_frame

 def on_frame(self, controller):
     frame = controller.frame()
     finger = frame.fingers.frontmost
     stabilizedPosition = finger.stabilized_tip_position
     interactionBox = frame.interaction_box
     normalizedPosition = interactionBox.normalize_point(stabilizedPosition)
     if finger.type() == 1:
         pyautogui.moveTo(normalizedPosition.x * pyautogui.size()[0], pyautogui.size()[1] - normalizedPosition.y * pyautogui.size()[1], 0)
         for gesture in frame.gestures():
             if gesture.type is lib.Leap.Gesture.TYPE_SCREEN_TAP:
                 screen_tap = LlibLeap.ScreenTapGesture(gesture)
                 print screen_tap
开发者ID:mjsolidarios,项目名称:gnomeleaper,代码行数:12,代码来源:GnomeLeaper.py

示例4: onClick

	def onClick(self, mouse_button):
		if mouse_button == 4: #scroll up
			prev = pyautogui.position()
			pyautogui.moveTo(0, pyautogui.size()[1], pause=False)
			pyautogui.scroll(1)
			pyautogui.moveTo(*prev, pause=False)
		elif mouse_button == 5: #scroll dn
			prev = pyautogui.position()
			pyautogui.moveTo(0, pyautogui.size()[1], pause=False)
			pyautogui.scroll(-1)
			pyautogui.moveTo(*prev, pause=False)
		else: #do nothing
			pass
开发者ID:MCManuelLP,项目名称:dotfiles,代码行数:13,代码来源:status_base.py

示例5: __init__

    def __init__(self):
        self.position=None
        self.droites=None
        self.win = gtk.Window()
        self.win.fullscreen()
        self.win.set_app_paintable(True)
        self.drawing_area = gtk.DrawingArea()
        self.drawing_area.set_size_request(pyautogui.size()[0],pyautogui.size()[1])
        self.win.add(self.drawing_area)

        self.drawing_area.connect("expose-event", self.expose)
        self.drawing_area.show()
        self.win.show()
开发者ID:bsamel,项目名称:awesome_pi,代码行数:13,代码来源:affichageDroite.py

示例6: setUp

    def setUp(self):
        self.oldFailsafeSetting = pyautogui.FAILSAFE
        self.center = P(*pyautogui.size()) // 2

        pyautogui.FAILSAFE = False
        pyautogui.moveTo(*self.center) # make sure failsafe isn't triggered during this test
        pyautogui.FAILSAFE = True
开发者ID:csampaio,项目名称:screen2text,代码行数:7,代码来源:autoguitest.py

示例7: crop

 def crop(x, y):
     w, h = pyautogui.size()
     x = max(x, 0)
     x = min(x, w-1)
     y = max(y, 0)
     y = min(y, h-1)
     return (x, y)
开发者ID:qedsoftware,项目名称:crashup,代码行数:7,代码来源:widget_tracker.py

示例8: test_onScreen

    def test_onScreen(self):
        width, height = pyautogui.size()
        halfWidth = int(width / 2)
        halfHeight = int(height / 2)

        self.assertTrue(pyautogui.onScreen(0, 0))
        self.assertTrue(pyautogui.onScreen([0, 0]))

        self.assertTrue(pyautogui.onScreen(halfWidth, 0))
        self.assertTrue(pyautogui.onScreen([halfWidth, 0]))
        self.assertTrue(pyautogui.onScreen(0, halfHeight))
        self.assertTrue(pyautogui.onScreen([0, halfHeight]))
        self.assertTrue(pyautogui.onScreen(halfWidth, halfHeight))
        self.assertTrue(pyautogui.onScreen([halfWidth, halfHeight]))

        self.assertFalse(pyautogui.onScreen(-1, 0))
        self.assertFalse(pyautogui.onScreen([-1, 0]))
        self.assertFalse(pyautogui.onScreen(-1, -1))
        self.assertFalse(pyautogui.onScreen([-1, -1]))
        self.assertFalse(pyautogui.onScreen(0, -1))
        self.assertFalse(pyautogui.onScreen([0, -1]))

        self.assertFalse(pyautogui.onScreen(width, 0))
        self.assertFalse(pyautogui.onScreen([width, 0]))
        self.assertFalse(pyautogui.onScreen(0, height))
        self.assertFalse(pyautogui.onScreen([0, height]))
        self.assertFalse(pyautogui.onScreen(width, height))
        self.assertFalse(pyautogui.onScreen([width, height]))
开发者ID:christophervalles,项目名称:pyautogui,代码行数:28,代码来源:basicTests.py

示例9: test_size

    def test_size(self):
        width, height = pyautogui.size()

        self.assertTrue(isinstance(width, int), 'Type of width is %s' % (type(width)))
        self.assertTrue(isinstance(height, int), 'Type of height is %s' % (type(height)))
        self.assertTrue(width > 0, 'Width is set to %s' % (width))
        self.assertTrue(height > 0, 'Height is set to %s' % (height))
开发者ID:christophervalles,项目名称:pyautogui,代码行数:7,代码来源:basicTests.py

示例10: mover

 def mover(self):
     self.screenSize = pyautogui.size()
     self.screenSize = list(self.screenSize)
     #print self.screenSize
     #self.move(10,10)
     tamano = self.geometry()
     #print tamano
     self.move(10, self.screenSize[1] - 275)
开发者ID:josem-m,项目名称:dena,代码行数:8,代码来源:main_pass_test.py

示例11: basic_api

def basic_api():

    cur_x, cur_y = pag.position()
    print(cur_x, cur_y)

    x, y = pag.size()
    print(x, y)

    '''
开发者ID:Rockyzsu,项目名称:base_function,代码行数:9,代码来源:pyautogui_mouse_simulation.py

示例12: move_mouse

def move_mouse(how_long_in_seconds):
    start_time = time.time()
    time_elapsed = time.time() - start_time
    xsize, ysize = pyautogui.size()
    
    while time_elapsed < how_long_in_seconds:
        x, y = random.randrange(xsize), random.randrange(ysize)
        pyautogui.moveTo(x, y, duration=0.2)
        time_elapsed = time.time() - start_time
开发者ID:avnishkgaur,项目名称:spreadyourvoice,代码行数:9,代码来源:prank2.py

示例13: move_the_mouse

def move_the_mouse():
    """Function moves the cursor in the upper right corner and then 100 px
    to the right side"""
    # Get the screen size
    screen_width, screen_height = pyautogui.size()
    # Move the mouse in a rectange shape
    pyautogui.moveTo(60, 60, duration=0.50)
    pyautogui.moveTo(screen_width - 60, 60, duration=0.50)
    pyautogui.moveTo(screen_width - 60, screen_height - 60, duration=0.50)
    pyautogui.moveTo(60, screen_height - 60, duration=0.50)
开发者ID:miroslavvidovic,项目名称:python-scripts,代码行数:10,代码来源:move_mouse.py

示例14: expose

    def expose(self,widget,event):
        cr = widget.window.cairo_create()
        cr.set_operator(cairo.OPERATOR_CLEAR)
        # Makes the mask fill the entire window
        cr.rectangle(0.0, 0.0, pyautogui.size()[0],pyautogui.size()[1])
        # Deletes everything in the window (since the compositing operator is clear and mask fills the entire window
        cr.fill()

        cr.set_operator(cairo.OPERATOR_OVER)

        cr.set_source_rgb(1,1,1)
        cr.set_line_width(1)
        with self.lock:
            if self.droites!=None:
                for droite in self.droites:
                    if len(droite)!=0:
                        cr.move_to(droite[0][0],droite[0][1])
                        for pos in droite:
                            cr.line_to(pos[0],pos[1])
                        cr.stroke()
开发者ID:bsamel,项目名称:awesome_pi,代码行数:20,代码来源:PrNoteDefault.py

示例15: go_standby

 def go_standby(self):
   self.tv_shutdown = (Main.WAIT_TIME) #reset timer
   screensize = pyautogui.size()
   pyautogui.moveTo(screensize[0]-8, 8)
   time.sleep(1)
   pyautogui.click()
   time.sleep(1)
   pyautogui.moveRel(0, 215)
   time.sleep(1)
   pyautogui.click()
   time.sleep(10)
开发者ID:imakin,项目名称:PersonalAssistant,代码行数:11,代码来源:standby-again.py


注:本文中的pyautogui.size函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。