代码运行效果如下:

注意:

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. test面板1

    Ext.onReady(function(){                var myPanel=new Ext.TabPanel({                    renderTo:Ex ...

  2. idea中使用thymeleaf标签时有红色的波浪线怎么去掉

    使用最新版本的idea2017可以解决,方法如下: 选择File->Settings->Editor->Inspections,然后搜索thymeleaf 将Expression v ...

  3. boost--ref

    1.ref简介 reference_wrapper包含在ref库中,它是引用包装器类型,即其内部包装了引用. 成员函数get().get_pointer()分别可以获得被包装的引用和其指针.使用需要包 ...

  4. java Concurrent包学习笔记(一):ExecutorService

    一.介绍 ExecutorService是java.util.concurrent包中的一个线程池实现接口.其有两个实现类: 1)ThreadPoolExecutor:普通线程池通过配置线程池大小,能 ...

  5. HDU 2147 kiki's game (奇偶博弈)

    题意:给定一个 n * m 的格子,从右上角(1, m) 开始每个玩家只能从向下,向左,或者向左下走,谁不能走,谁输. 析:自己做出来,看了网上的几个博客,好像都没说为什么是只有全奇的情况才会输,个人 ...

  6. 基于udp协议的套接字,socketserver模块,多道技术,进程理论

    进程指的是一个正在进行/运行的程序,进程是用来描述程序执行过程的虚拟概念 进程vs程序 程序:一堆的代码 进程:程序执行的过程 进程的概念起源于操作系统,进程是操作系统最核心的概念,操作系统的其他所有 ...

  7. issubclass ,isinstance,反射

    issubclass() 函数 issubclass() 方法用于判断参数 class 是否是类型参数 classinfo 的子类. 语法 以下是 issubclass() 方法的语法: issubc ...

  8. ZUFE2483 DO IT YOURSELF 2017-05-31 14:41 40人阅读 评论(0) 收藏

    2483: DO IT YOURSELF 时间限制: 2 Sec  内存限制: 128 MB 提交: 8  解决: 3 [提交][状态][讨论版] 题目描述 有四个字符串S,T,tmp,ans,一开始 ...

  9. bootstrap1相关学习文档

    <em>Bootstrap 框架</em>                                                    //倾斜 4.对齐 //设置文 ...

  10. Excel函数vlookup

    最近整理业务文档,需要用到excel,按照教程,操作了20来分钟,却得不到结果. 看了视频,才知道,vlookup仅限关联选中区域的第一列关联,把要关联的行拷贝到第一列,解决. https://www ...