""" 1、项目中有哪些类 2,、每个类中有哪些方法 1.坦克类 射击 移动 显示坦克的方法 2.子弹类 移动 显示子弹方法 3.墙壁类 属性:是否可以通过 4.爆炸效果类 展示爆炸效果 5.音效类 播放音乐 6.主类 开始游戏 结束游戏 """ """ 新增功能 :加载主窗口 """ import pygame SCREEN_WIDTH=700 SCREEN_HEIGHT=500 class MainGame(): window=None def __init__(self): pass #开始游戏 def startGame(self): # 初始化显示模块 pygame.display.init() #设置窗口大小及显示 MainGame.window=pygame.display.set_mode([SCREEN_WIDTH,SCREEN_HEIGHT]) while True: pygame.dislay.update def endGame(self): pass class Tank(): def __init__(self): pass #移动 def move(self): pass #射击 def shot(self): pass #展示坦克方法 def displayTank(self): pass #我放坦克 class MyTank(Tank): def __init__(self): pass #敌方坦克 class EnemyTank(Tank): def __init__(self): pass #子弹类 class Bullet(): def __init__(self): pass #移动 def move(self): pass #展示子弹的方法 def displayBullet(self): pass class Wall(): def __init__(self): pass #展示墙壁额方法 def displayWall(self): pass class Explode(): def __init__(self): pass def displayExlode(self): pass class Music(): def __init__(self): pass def play(self): pass if __name__=='__main__': MainGame().startGame()
href里面必须是单引号什么意思?编辑器里面自动补全是
<a href=""></a>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style> .top{ width: 100%; height: 50px; background: url(img/IMG_20190820_082424.jpg) repeat scroll top left; } .center{ width: 100%; height: 200px; background-color:beige; } .down{ width: 100%; height: 50px; background-color: blueviolet; } .center_1{ width: 100px; height: 100px; background: brown; position: relative; left: 450px; top: 10px; } .center_2{ width: 100px; height: 200px; background: black; } </style> </head> <body> <div class="top"> <a href="http://www.baidu.com"> 简介</a> </div> <div class="center"> <div class="center_2"></div> <div class="center_1"></div> </div> <div class="down"> </div> </body> </html>
如何将中间两个叠加对齐?
老师 我的一直报这个错 链接:https://pan.baidu.com/s/13AwEVC8ssZulsZlFE1dgVQ 密码:vhr6
这个怎么感觉跟DataOutputStream没啥区别?都能写int,char,UTF啥的
老师,我不明白为什么title的类型为字符串呢,其他的都为对象。
<div id="d" style="width: 100px;height: 100px;background: red">文本</div>
<script> var t=document.getElementById("d"); console.log(typeof(t)); console.log(typeof(document.title)); console.log(typeof(document.head)); console.log(typeof(document.body)); </script>
老师能不能提交其他资料的时候将软件工具的文件给线上也提交一下,不然下载太慢了
关于3,a b 中两个原本不合法,但在提问中,同学发现合法的代码,
3 a 中 ename是显示不同job组中,第一个人的name吗?
3 b 中 empno的结果,是所有empno的数字相加吗?
老师,是不是我那个地方写错了
package com.bjsxt.thread.prosumer2; /** * <p>Title: TestConsumer</p> * <p>Description: 消费者模式</p> * @author xiaoding * @date Jul 20, 2020 * @version 1.0 */ public class TestConsumer implements Runnable{ //功能属性 private TestSupermarket supermarket; //超市 //构造方法 public TestConsumer(TestSupermarket supermarket) { this.supermarket = supermarket; } //定义线程体 @Override public void run() { for (int i = 0;i<10;i++) { supermarket.getConsumer(); } } } package com.bjsxt.thread.prosumer2; /** * <p>Title: TestProducer</p> * <p>Description: 生产者模式</p> * @author xiaoding * @date Jul 20, 2020 * @version 1.0 */ public class TestProducer implements Runnable{ //功能属性 private TestSupermarket supermarket; //超市 //构造方法 public TestProducer(TestSupermarket supermarket) { this.supermarket = supermarket; } //定义线程体 @Override public void run() { for (int i = 0;i<10;i++) { if (i % 2 != 0) { supermarket.setProducer("旺仔","小馒头"); }else { supermarket.setProducer("康师傅","红烧牛肉面"); } } } } package com.bjsxt.thread.prosumer2; /** * <p>Title: TestSupermarket</p> * <p>Description: 超市(存储)</p> * @author xiaoding * @date Jul 20, 2020 * @version 1.0 */ public class TestSupermarket { // 功能属性 private String brand; //品牌 private String name; //名称 //构造方法 public TestSupermarket() {} public TestSupermarket(String brand,String name) { this.brand = brand; this.name = name; } //get、set public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public String getName() { return name; } public void setName(String name) { this.name = name; } //定义同步方法Producer public synchronized void setProducer(String brand,String name) { this.setBrand(brand); try { Thread.sleep(300); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.setName(name); System.out.println("生产者生产了:" + this.getBrand() + this.getName()); } public synchronized void getConsumer() { System.out.println("消费者消费了:" + this.getBrand() + this.getName()); } }
测试结果:
方法区中加载的类也有内存地址吧?与new出的对象的内存地址不一样吧?
为啥代码一样,老是有错呢?老师,php有没有能够提示的插件啥的
''' 验证运行速度,用循环增加多个线程 ''' #调用创建线程模块 from threading import Thread from time import sleep from threading import Lock #定义方法 def f1(self): print(f'threading:{self}start',) sleep(3) #获取锁 lock.acquire() global count for i in range(1000000): count+=1 sleep(10) lock.release() print(f'threading:{self}end',) #创建线程 if __name__=='__main__': lock=Lock() count=0 t_list=[] for i in range(3): t=Thread(target=f1,args=(f't{i+1}',)) t.setDaemon(True) t_list.append(t) t.start() for t in t_list: t.join() print(count)
为什么这个代码end可以输出来,我不是先守护线程,怎么还要运行join()呢
老师,您好,请问在创建P1变量的时候,为甚么说P1是占4个字节?
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>编写一个带有hover样式的导航栏,要求采用鼠标事件实现</title> </head> <body> <script> var arr = ["首页","军事","新闻","我们"]; var ul = document.createElement('ul'); var ul_style = document.createAttribute('style'); ul_style.value="list-style: none;margin: 0px;padding: 0px;"; ul.setAttributeNode(ul_style); for (var i = 0;i<arr.length;i++){ var li = document.createElement("li"); var li_style = document.createAttribute("style"); li_style.value="display: block;float: left;width: 150px;height: 50px;" + "line-height: 50px;text-align: center;background:pink;margin-left:100px;"; li.setAttributeNode(li_style); var a = document.createElement("a"); var a_style = document.createAttribute("style"); a_style.value="text-decoration: none;"; a.setAttributeNode(a_style); a.innerHTML=arr[i]; li.appendChild(a); ul.appendChild(li); } document.body.appendChild(ul); //li事件 var li = document.querySelector('li'); li.onmouseover = function () { li.style.background='yellow'; }; li.onmouseout = function () { li.style.background="pink"; }; //超链接事件 var a = document.querySelector('a'); a.onmouseover = function () { a.style.color="white"; }; a.onmouseleave = function () { a.style.color="#ccc"; }; </script> </body> </html>
老师,你好,请问一下怎么设置属性能让每个li元素都有鼠标事件,我这样设置的只有第一个li产生了鼠标事件?
为啥会报405?
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637