#screen = pygame.display.set_mode(size,pygame.FULLSCREEN) #将屏幕设置为全屏模式 pygame.display.set_caption("壁球游戏") #将窗口命名为“壁球游戏” ball = pygame.image.load("biu.jpg") #加载图片 ballrect = ball.get_rect() #返回一个覆盖图像的矩
screenWidth = window.winfo_screenwidth() screenHeight = window.winfo_screenheight() # 计算主窗口在屏幕上的坐标 x = int((screenWidth - winWidth)/ 2) y = int((screenHeight - winHeight) / 2) # 设置主窗口标题 window.title("主窗体参数说明") # 设置主窗口大小 window.geometry("%sx%s+%s...
screen_height))# 设置窗口标题pygame.display.set_caption("俄罗斯方块")# 游戏主循环running=Truewhile...
importtkinter as tk#创建窗体window =tk.Tk()defcall():globalwindow window.destroy()defmain():globalwindow#设置主窗体大小winWidth = 600winHeight= 400#获取屏幕分辨率screenWidth =window.winfo_screenwidth() screenHeight=window.winfo_screenheight()#计算主窗口在屏幕上的坐标x = int((screenWidth - w...
screen.blit(textRender,(WIDTH/scale[0],HEIGHT/scale[1])) SysFont(name, size, bold=False, italic=False) -> Font 从系统字体库中加载并返回一个新的字体对象。该字体将会匹配 bold(加粗)和 italic(斜体)参数的要求。如果找不到一个合适的系统字体,该函数将会回退并加载默认的 pygame 字体。尝试搜索的...
import sysimport cfgimport pygamefrom modules import * '''定义按钮'''def Button(screen, position, text, button_size=(200, 50)): left, top = position bwidth, bheight = button_size pygame.draw.line(screen, (150, 150, 150), (left, top), (left+bwidth, top), 5) pygame.draw.line(...
from modules import * '''定义按钮''' def Button(screen, position, text, button_size=(...
import pyautogui # 获取当前屏幕分辨率 screenWidth, screenHeight = pyautogui.size() # 获取当前鼠标位置 currentMouseX, currentMouseY = pyautogui.position() # 2秒钟鼠标移动坐标为100,100位置 绝对移动 #pyautogui.moveTo(100, 100,2) pyautogui.moveTo(x=100, y=100,duration=2, tween=pyautogui...
获取当前访问页面 url current_url 获取当前浏览器标题 title 保存图片 get_screenshot_as_png()/get_screenshot_as_file(file) 网页源码 page_source 3、元素的操作 点击操作 element.click() 清空输入框 element.clear() 输入框输入数据 element.send_keys(data) ...
service=Service(r'C:\Program Files (x86)\Microsoft\Edge\Application\msedgedriver.exe')driver=webdriver.Edge(service=service)driver.get('https://www.bilibili.com/')time.sleep(5)#在搜索框输入字符串driver.find_element('xpath','//input[@class="nav-search-input" and @type="text"]').send_ke...