摘要:
#_author:来童星#date:2019/12/22 import pygame import sys pygame.init() size=width,height=640,480 screen=pygame.display.set_mode(size) color=(0,0,0) ball= 阅读全文
摘要:
#_author:来童星#date:2019/12/21# 事件处理import wxclass MyFrame(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(self,parent,id,'用户登录',size=(400,30 阅读全文
摘要:
#_author:来童星#date:2019/12/20#创建一个wx.App的子类import wxclass App(wx.App): #初始化方法 def OnInit(self): frame=wx.Frame(parent=None,title='hello wxpython')# 创建窗 阅读全文
摘要:
#_author:来童星#date:2019/12/19import pymysql#1.打开数据库连接db=pymysql.connect('localhost','root','root','test')#2.使用cursor()方法创建一个游标对象cursor=db.cursor()#3.使用 阅读全文
摘要:
#_author:来童星#date:2019/12/18def division(): num1=int(input('请输入被除数:')) num2=int(input('请输入除数:')) if num2==0: raise ValueError('除数不能为0') result=num1//n 阅读全文
摘要:
#_author:来童星#date:2019/12/18def division(): num1=int(input('请输入被除数:')) num2=int(input('请输入除数:')) result=num1//num2 print(result)if __name__=='__main__ 阅读全文
摘要:
import sockethost='127.0.0.1'port=8080web=socket.socket()web.bind((host,port))web.listen(5)# 设置最多连接数print('服务器等待客户端连接')#开启死循环while True: coon,addr=web 阅读全文
摘要:
#_author:来童星#date:2019/12/17#生产者消费者模式-->线程from queue import Queueimport random,time,threading#生产者class Producer(threading.Thread): def __init__(self,n 阅读全文
摘要:
#_author:来童星#date:2019/12/17#互斥锁from threading import Thread,Lockimport timen=100def func(): global n mutex.acquire() temp=n time.sleep(0.1) n=temp-1 阅读全文
摘要:
#_author:来童星#date:2019/12/17from threading import Threadimport timedef plus(): print('子线程1开始') global num num+=50 print('num is %d'%num) print('子线程1结束 阅读全文