本文整理汇总了Python中pyautogui.size函数的典型用法代码示例。如果您正苦于以下问题:Python size函数的具体用法?Python size怎么用?Python size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了size函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: clickCenter
def clickCenter (**options):
displayMagnification = 2 if sysvar_ratina == True else 1
if sysvar_right == 0:
width, hegith = pyautogui.size()
print(width, hegith)
pyautogui.moveTo(width/2, hegith/2, 2)
else:
pyautogui.moveTo((sysvar_top/displayMagnification) + ((sysvar_right-sysvar_left)/(displayMagnification*2)),
(sysvar_left/displayMagnification) + ((sysvar_bottom-sysvar_top)/(displayMagnification*2)),
2)
pyautogui.click()
pyautogui.moveTo(10, 10) # 10, 10 for avoid fail-safe
开发者ID:mtsukuda,项目名称:bitrunner,代码行数:14,代码来源:bitrunner.py
示例17: getCoordinatesForMSComponents
def getCoordinatesForMSComponents():
width, height = pyautogui.size()
log("Screen size: %s x %s" %(width, height))
# To get coordinate on the screen, presse Command+Shitft+4; press Esp button to
# get out of this mode (Mac)
coordinates = {
'symbolEntry': { 'x': 70, 'y': platform.offsetY + 78 },
'daily': { 'x': 220, 'y': platform.offsetY + 78 },
'weekly': { 'x': 290, 'y': platform.offsetY + 78 },
'monthly': { 'x': 360, 'y': platform.offsetY + 78 },
'printButton': { 'x': width - 107, 'y': platform.offsetY + 106 }
}
return coordinates
开发者ID:hn4002,项目名称:auto-save-mscharts,代码行数:14,代码来源:main.py
示例18: __init__
def __init__(self):
self.osName = platform.system()
self.pcName = os.environ['computername']
self.screenSize = pyautogui.size()
print "Operation system is: ", self.osName
print "PC name is: ", self.pcName
self.mouseMap = ['left', 'middle', 'right']
self.controller = pyautogui
self.pyMouse = PyMouse()
self.pyKeyboard = PyKeyboard()
self.keyboardMap = {}
self.initKeyboardMap()
开发者ID:neltica,项目名称:Total-control,代码行数:14,代码来源:ControlMainClass.py
示例19: example
def example():
screenWidth, screenHeight = pag.size()
currentMouseX, currentMouseY = pag.position()
pag.moveTo(500, 550)
pag.click()
pag.moveRel(None, 10) # move mouse 10 pixels down
pag.doubleClick()
# pag.moveTo(500, 500, duration=2, tween=pyautogui.tweens.easeInOutQuad) # use tweening/easing function to move mouse over 2 seconds.
pag.typewrite('Hello world!', interval=0.25) # type with quarter-second pause in between each key
pag.press('esc')
pag.keyDown('shift')
pag.press(['left', 'left', 'left', 'left', 'left', 'left'])
pag.keyUp('shift')
pag.hotkey('ctrl', 'c')
delta_y = 50
开发者ID:Rockyzsu,项目名称:base_function,代码行数:15,代码来源:pyautogui_mouse_simulation.py
示例20: screenSetup
def screenSetup():
width, height = pyautogui.size() #get the width and height of the screen
print(width)
print(height)
global qWidth
global tHeight
global q3Width
qWidth = width/4
q3Width = width/3
tHeight = height/3
dotSize = 26
x1 = (numpy.mean([0, qWidth]) - (dotSize/2))
y1 = (numpy.mean([0,tHeight]) - (dotSize/2))
x2 = x1 + qWidth
x3 = x2 + (qWidth/2)
x4 = x2 + qWidth
x5 = x4 + qWidth
y2 = y1 + tHeight
y3 = y2 +tHeight
canvasFrame = Frame(root, bg = "red", width = width, height = (height - 100))
instructionFrame = Frame(root, width = width, bg = "red", height = 50)
canvas = Canvas(canvasFrame, width = width, height = (height - 100))
canvas.create_oval(x1, y1, (x1 + dotSize), (y1 + dotSize), outline = "gray", fill = "gray") #top left
canvas.create_oval(x3, y1, (x3 + dotSize), (y1 + dotSize), outline = "gray", fill = "gray") #top middle
canvas.create_oval(x5, y1, (x5 + dotSize), (y1 + dotSize), outline = "gray", fill = "gray") #top right
canvas.create_oval(x1, y2, (x1 + dotSize), (y2 + dotSize), outline = "gray", fill = "gray") #middle left
canvas.create_oval(x2, y2, (x2 + dotSize), (y2 + dotSize), outline = "gray", fill = "gray") #middle second left
canvas.create_oval(x4, y2, (x4 + dotSize), (y2 + dotSize), outline = "gray", fill = "gray") #middle third left
canvas.create_oval(x5, y2, (x5 + dotSize), (y2 + dotSize), outline = "gray", fill = "gray") #middle right
canvas.create_oval(x1, y3, (x1 + dotSize), (y3 + dotSize), outline = "gray", fill = "gray") #bottom left
canvas.create_oval(x3, y3, (x3 + dotSize), (y3 + dotSize), outline = "gray", fill = "gray") #bottom middle
canvas.create_oval(x5, y3, (x5 + dotSize), (y3 + dotSize), outline = "gray", fill = "gray") #botton right
submitButton = Button(instructionFrame, text = "Submit", command = moveMouse)
canvasFrame.grid()
canvas.grid(sticky = W)
instructionFrame.grid(row = 1)
submitButton.grid()
开发者ID:Qwertycal,项目名称:19520-Eye-Tracker,代码行数:45,代码来源:calibrationScreen10Dots.py
注:本文中的pyautogui.size函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论