本文整理汇总了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()
示例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)
示例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
示例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
示例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()
示例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
示例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)
示例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]))
示例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))
示例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)
示例11: basic_api
def basic_api():
cur_x, cur_y = pag.position()
print(cur_x, cur_y)
x, y = pag.size()
print(x, y)
'''
示例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
示例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)
示例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()
示例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)