代码运行效果如下:

注意:

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 -猜字小游戏的更多相关文章

  1. LY.猜字小游戏

    猜字小游戏

  2. Demo_2:Qt实现猜字小游戏

    1  环境 系统:windows 10 代码编写运行环境:Qt Creator 4.4.1 (community) Github: 2  简介 参考视频:https://www.bilibili.co ...

  3. Python猜数小游戏

    使用random变量随机生成一个1到100之间的数 采集用户所输入的数字,如果输入的不符合要求会让用户重新输入. 输入符合要求,游戏开始.如果数字大于随机数,输出数字太大:如果小于随机数,输出数字太小 ...

  4. 初识python: while循环 猜年龄小游戏

    知识点: 1.python注释方法: 单行注释: # 多行注释: '''注释内容 '''  (单引号或双引号都可以),亦可打印多行 例: #此处是单行注释信息 print('这里是打印内容') #这里 ...

  5. 简单的猜数字小游戏--Python

    猜数字小游戏: #coding=utf-8 import random   answer =random.randint(1,100) #生成随机数 n=int (input("Please ...

  6. 关于切片/截取(slice)和random模块的使用(实例:猜单词小游戏)

    切片和random的使用在源码中都有注释(可以直接下载):https://github.com/NoobZeng/GuessWords 1. README.MD 基于Python的猜单词游戏 猜单词小 ...

  7. day06-java-(方法,猜字符小游戏)

    day05-java-(方法,猜字符小游戏) 1.方法:  1)用于封装一段特定的逻辑功能  2)方法应尽可能的独立,只干一件事  3)方法可以被反复的调用多次  4)避免代码重复,有利于代码的维护, ...

  8. Java基础知识强化之IO流笔记70:Properties练习之 如何让猜数字小游戏只能玩5次的案例

    1. 使用Properties完成猜数字小游戏只能玩5次的案例: 2. 代码实现: (1)猜数字游戏GuessNumber: package cn.itcast_08; import java.uti ...

  9. java猜数字小游戏

    /* * * 猜数字小游戏 * * 先由系统生成一个2-100之间的随机数字, * * 然后捕获用户从控制台中输入的数字是否与系统生成的随机数字相同, * * 如果相同则统计用户所猜的次数,并给出相应 ...

随机推荐

  1. NOIP 2017 d2t2 70points

    革命之路漫漫 第一次尝试 40points spfa #include <bits/stdc++.h> #define read read() using namespace std; i ...

  2. CHAPITRE III

    Il me fallut longtemps pour comprendre d'où il venait. Le petit prince, qui me posait beaucoup de qu ...

  3. 信息安全技术PGP实验 20155205 20155218

    信息安全技术PGP实验 一.实验过程 PGP的安装与设置(Mac版) 访问GPGTools网站,下载GPG Suite for OS X,下载完毕,双击dmg文件,运行安装操作. 创建PGP密钥(一定 ...

  4. Java实现FTP批量大文件上传下载篇1

    本文介绍了在Java中,如何使用Java现有的可用的库来编写FTP客户端代码,并开发成Applet控件,做成基于Web的批量.大文件的上传下载控件.文章在比较了一系列FTP客户库的基础上,就其中一个比 ...

  5. 【1】jQuery异步(Ajax)操作之JSONP [转]

     前言: 说到AJAX就会不可避免的面临两个问题,第一个是AJAX以何种格式来交换数据?第二个是跨域的需求如何解决?这两个问题目前都有不同的解决方案,比如数据可以用自定义字符串或者用XML来描述,跨域 ...

  6. 20170905工作日记--listview优化大全

    1. 适配器设计模式 实例描述:我们国家的电器使用普通的扁平两项或三项插头,而去外国的话,使用的标准就不一样了,比如德国,使用的是两项圆头的插头,那么我们使用的手机充电器插头无法插到德国的插排中去,那 ...

  7. css3实现卡牌旋转与物体发光效果

    效果演示 http://demo.qpdiy.com/hxw/CSS3/rotate+light.html 物体旋转: 卡牌同一位置放2张图片,通过设置3D动画旋转实现 animation: card ...

  8. day27(反射之内省机制实现BeanUtils)

    使用内省方式来实现beanUtils往对象里面存值 public class BeanInfoUtil2 { public static void setPropertyByIntrospector( ...

  9. 【repost】 原生JS执行环境与作用域深入理解

    首先,我们要知道执行环境和作用域是两个完全不同的概念. 函数的每次调用都有与之紧密相关的作用域和执行环境.从根本上来说,作用域是基于函数的,而执行环境是基于对象的(例如:全局执行环境即window对象 ...

  10. Android 百度云推送

    http://developer.baidu.com/wiki/index.php?title=docs/cplat/push/sdk/clientsdk. public class DemoAppl ...