补发代码和截图
import wx class MyFrame(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,title="创建TextCtrl类",size=(400,300)) panel=wx.Panel(self) self.title=wx.StaticText(panel,label="请输入用户名和密码",pos=(140,20)) self.label_user=wx.StaticText(panel,label="用户名:",pos=(50,50)) self.text_user=wx.TextCtrl(panel,pos=(100,50),size=(235,25),style=wx.TE_LEFT) self.label_pwd=wx.StaticText(panel,pos=(50,90),label="密 码:") self.text_password=wx.TextCtrl(panel,pos=(100,90),size=(235,25),style=wx.TE_PASSWORD) self.bt_confirm=wx.Button(panel,label='确定',pos=(105,130)) self.bt_concel=wx.Button(panel,label='取消',pos=(195,130)) if __name__=='__main__': app=wx.App() frame=MyFrame(parent=None,id=-1) frame.Show() app.MainLoop()
import sys import pygame pygame.init() size = width,height = 640,480 screen = pygame.display.set_mode(size) color = (0,0,0) wjk = pygame.image.load("ball.png") wjkrect = wjk.get_rect() speed = [6,6] while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() wjkrect = wjkrect.move(speed) #碰到左右边缘 if wjkrect.left < 0 or wjkrect.right > width: speed[0] = -speed[0] if wjkrect.top < 0 or wjkrect.bottom > height: speed[1] = -speed[1] screen.fill(color) screen.blit(wjk,wjkrect) pygame.display.flip()
# -*- coding: utf-8 -*- """ Created on Wed Dec 15 10:18:09 2021 @author: liang """ import pygame import sys #import random class Bird(object): """定义一个鸟类""" def __init__(self): """定义初始化方法""" pass def birdUpdate(self): pass class Pipeline(object): def __init__(self): pass def __updatePipeline__(self): pass def createMap(): """定义创建地图的方法""" screen.fill((255,255,255)) screen.blit(background,(0,0)) pygame.display.flip() if __name__ == '__main__': """主程序""" pygame.init() size = width,height = 400,650 screen = pygame.display.set_mode(size) clock = pygame.time.Clock() Pipeline = Pipeline() Bird = Bird() while True: clock.tick(60) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() background = pygame.image.load("background.png") createMap()
名字:宋梓琪
学号:2020310143039
posted on 2021-12-15 23:37 蓝螃蟹Karry0921 阅读(15) 评论(0) 编辑 收藏 举报