python -猜字小游戏
代码运行效果如下:

注意:
1.必须要在python3环境想使用
2.QQ:3084276329(一起交流学习)
3.还请大家评论
Guess the word game代码如下:
#! /usr/bin/env python
# -*- coding: utf- -*-
# Guess the word game
# 博客:https://www.cnblogs.com/muxii
# 那个木兮啊
import tkinter
import threading
import time
from tkinter import *
from tkinter import messagebox
from tkinter import messagebox root = tkinter.Tk()
root.title('那个木兮啊-Guess the word')
root.minsize(,) label =(root)
label = Label(root,text = '博客:https://www.cnblogs.com/muxii/\nQQ:3084276329\n—-————那个木兮啊——-———',font = ('微软雅黑',),fg = 'red')
label.grid(row = ,column =)
btn1 = tkinter.Button(root,text ='',width = ,height =,bg='blue')
btn1.place(x=,y=)
btn2 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn2.place(x=,y=)
btn3 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn3.place(x=,y=)
btn4 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn4.place(x=,y=)
btn5 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn5.place(x=,y=)
btn6 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn6.place(x=,y=)
btn7 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn7.place(x=,y= )
btn8 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn8.place(x=,y=)
btn9 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn9.place(x=,y= )
btn10 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn10.place(x=,y=)
btn11 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn11.place(x=,y=)
btn12 = tkinter.Button(root,text = '',width = ,height =,bg ='white')
btn12.place(x=,y=)
herolists = [btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btn11] isloop = False stopsing = False
#定义停止id
stopid = None #定义函数,循环选项 设置背景颜色,选中的为红色,
def round():
global isloop
global stopid
if isloop ==True:
return
i =
#判断一个对象是否已经类型 type
#考虑继承关系
if isinstance(stopid,int):
i = stopid while True:
#
time.sleep(0.05)#延时
for x in herolists:
x['bg'] = 'white' herolists[i]['bg'] ='blue' i += if i >= len(herolists):
i = if stopsing == True:
isloop =False
stopid = i
break #停止
def stop1(): global stopsing if stopsing == True:
return
stopsing = True #开始
def newtask():
global isloop
global stopsing
stopsing = False
#建立线程
t = threading.Thread(target = round )
t.start()
isloop = True btn_start = tkinter.Button(root,text = '开始',bg = 'red',command = newtask)
btn_start.place(x=,y=)
#
btn_stop = tkinter.Button(root,text = '结束',bg = 'yellow',command = stop1)
btn_stop.place(x=,y= ) root.mainloop()
2018.8.3
python -猜字小游戏的更多相关文章
- LY.猜字小游戏
		
猜字小游戏
 - Demo_2:Qt实现猜字小游戏
		
1 环境 系统:windows 10 代码编写运行环境:Qt Creator 4.4.1 (community) Github: 2 简介 参考视频:https://www.bilibili.co ...
 - Python猜数小游戏
		
使用random变量随机生成一个1到100之间的数 采集用户所输入的数字,如果输入的不符合要求会让用户重新输入. 输入符合要求,游戏开始.如果数字大于随机数,输出数字太大:如果小于随机数,输出数字太小 ...
 - 初识python: while循环 猜年龄小游戏
		
知识点: 1.python注释方法: 单行注释: # 多行注释: '''注释内容 ''' (单引号或双引号都可以),亦可打印多行 例: #此处是单行注释信息 print('这里是打印内容') #这里 ...
 - 简单的猜数字小游戏--Python
		
猜数字小游戏: #coding=utf-8 import random answer =random.randint(1,100) #生成随机数 n=int (input("Please ...
 - 关于切片/截取(slice)和random模块的使用(实例:猜单词小游戏)
		
切片和random的使用在源码中都有注释(可以直接下载):https://github.com/NoobZeng/GuessWords 1. README.MD 基于Python的猜单词游戏 猜单词小 ...
 - day06-java-(方法,猜字符小游戏)
		
day05-java-(方法,猜字符小游戏) 1.方法: 1)用于封装一段特定的逻辑功能 2)方法应尽可能的独立,只干一件事 3)方法可以被反复的调用多次 4)避免代码重复,有利于代码的维护, ...
 - Java基础知识强化之IO流笔记70:Properties练习之 如何让猜数字小游戏只能玩5次的案例
		
1. 使用Properties完成猜数字小游戏只能玩5次的案例: 2. 代码实现: (1)猜数字游戏GuessNumber: package cn.itcast_08; import java.uti ...
 - java猜数字小游戏
		
/* * * 猜数字小游戏 * * 先由系统生成一个2-100之间的随机数字, * * 然后捕获用户从控制台中输入的数字是否与系统生成的随机数字相同, * * 如果相同则统计用户所猜的次数,并给出相应 ...
 
随机推荐
- Gym-100883F、Gym-101095B状态压缩小结
			
状态压缩的核心思想就是将数压缩成二进制,用二进制位来表示对应的位能取或者不能取,相比起来很方便. Eg:Gym-100883F 题意:给你两个字符串,要求你将两个字符串合起来,并不改变原先的顺序,一共 ...
 - 33、iOS10 由于权限问题导致崩溃的大坑
			
控制台报忠告: This app has crashed because it attempted to access privacy-sensitive data without a usage d ...
 - php 操作redis  以及几个常用命令
			
redis-cli -h host -p port -a password 首次进入redis 进行绑定ip和端口号 del key 删除指定key exists key 检查指定key是否存 ...
 - C++程序生成.exe文件,在文件夹中运行时闪现问题
			
问题描述:在IDE(此为Dev-C++)中编写C++程序,运行时会产生如下文字 但我想取消这三行的显示. 解决方法:1:在IDE中运行时,“请按任意键继续”是消失不掉的,但在该程序的保存路径下可以消灭 ...
 - 补全爬取的url
			
有时爬取到的href不全,如href=‘/11031/’解决方法:from urllib import parseurl=parse.urljoin(response.url,get_url)resp ...
 - Booksim的运行
			
1.下载flex和bison解压到/home/cp/booksim2-master/src; 2.进入flex.bison的目录下分别执行: ./configure make make install ...
 - CSS Sprites (CSS 精灵) 技术
			
CSS Sprites在国内很多人叫css精灵,是一种网页图片应用处理方式.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢 ...
 - openstack之镜像管理
			
概览 [root@cc07 fast-pulsar]# glance help | grep image [--os-image-url OS_IMAGE_URL] [--os-image-api-v ...
 - 实现1sym转换成2个sym送给CVI(VGA数据)
			
CVI的时序如下 :de指示数据有效. 从下面的程序看,同步码的长度不会影响对有效数据的判断.同步码的作用更多的是用于计算行及一行的像素数目.方案一: 1 module vga_1sym_2_2sym ...
 - x86_64汇编调试程序初步
			
寄存器说明: rdi 存第1个参数(值或地址) rsi 存第2个参数 rdx 存第3个参数 rcx 存第4个参数 r8 存第5个参数 r9 存第6个参数 rax 第1个返回值 rdx 第2个返回值 r ...