• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python simpleguitk.load_image函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中simpleguitk.load_image函数的典型用法代码示例。如果您正苦于以下问题:Python load_image函数的具体用法?Python load_image怎么用?Python load_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load_image函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self):
     """
     Create a frame and load the cancer data
     """
     self._frame = simplegui.create_frame("Cancer risk visualization", CANVAS_WIDTH, CANVAS_HEIGHT)
     self._frame.set_canvas_background("White")
     self._frame.set_draw_handler(self.draw)
     self._frame.add_input("Enter cutoff (scaled by 0.00001)", self.enter_cutoff, 200)
     self._frame.add_button("Print data table in CSV", self.print_table, 200)
     self._data_table = self.load_data()
     self.enter_cutoff("0.0")
     self._USA_Counties = simplegui.load_image(MAP_URL)
     self._frame.start()
开发者ID:GauravKataria,项目名称:Algorithmic_Thinking_Coursera,代码行数:13,代码来源:user38_counties_simplegui_0.py


示例2: __init__

 def __init__(self, game):
     self._cols = game.get_grid_height()
     self._rows = game.get_grid_width()
     self._frame = simplegui.create_frame(
         "2048", self._rows * TILE_SIZE + 2 * BORDER_SIZE, self._cols * TILE_SIZE + 2 * BORDER_SIZE
     )
     self._frame.add_button("New Game", self.start)
     self._frame.set_keydown_handler(self.keydown)
     self._frame.set_draw_handler(self.draw)
     self._frame.set_canvas_background("#A39480")
     self._frame.start()
     self._game = game
     url = "http://codeskulptor-assets.commondatastorage.googleapis.com/assets_2048.png"
     self._tiles = simplegui.load_image(url)
     self._directions = {"up": UP, "down": DOWN, "left": LEFT, "right": RIGHT}
开发者ID:romperstomper,项目名称:pc,代码行数:15,代码来源:poc_2048_gui.py


示例3: __init__

 def __init__(self, game):
     self._game = game
     self._rows = game.get_grid_height()
     self._cols = game.get_grid_width()
     self._frame = simplegui.create_frame('2048',
                     self._cols * TILE_SIZE + 2 * BORDER_SIZE,
                     self._rows * TILE_SIZE + 2 * BORDER_SIZE)
     self._frame.add_button('New Game', self.start)
     self._frame.set_keydown_handler(self.keydown)
     self._frame.set_draw_handler(self.draw)
     self._frame.set_canvas_background("#BCADA1")
     self._tiles = simplegui.load_image(IMAGE_URL)
     self._directions = {"up": UP, "down": DOWN,
                         "left": LEFT, "right": RIGHT}
     self._frame.start()
开发者ID:lingchunkai,项目名称:2048_ai,代码行数:15,代码来源:poc_2048_gui.py


示例4: get_radius

    def get_radius(self):
        return self.radius

    def get_lifespan(self):
        return self.lifespan

    def get_animated(self):
        return self.animated

    
# art assets created by Kim Lathrop, may be freely re-used in non-commercial projects, please credit Kim
    
# debris images - debris1_brown.png, debris2_brown.png, debris3_brown.png, debris4_brown.png
#                 debris1_blue.png, debris2_blue.png, debris3_blue.png, debris4_blue.png, debris_blend.png
debris_info = ImageInfo([320, 240], [640, 480])
debris_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/debris2_blue.png")

# nebula images - nebula_brown.png, nebula_blue.png
nebula_info = ImageInfo([400, 300], [800, 600])
nebula_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/nebula_blue.f2014.png")

# splash image
splash_info = ImageInfo([200, 150], [400, 300])
splash_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/splash.png")

# ship image
ship_info = ImageInfo([45, 45], [90, 90], 35)
ship_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/double_ship.png")

# missile image - shot1.png, shot2.png, shot3.png
missile_info = ImageInfo([5,5], [10, 10], 3, 50)
开发者ID:Raag079,项目名称:Programming-in-Python,代码行数:31,代码来源:RiceRocks+(Asteroids).py


示例5: get_radius

		return self.size

	def get_radius(self):
		return self.radius

	def get_lifespan(self):
		return self.lifespan

	def get_animated(self):
		return self.animated

# art assets created by Kim Lathrop, may be freely re-used in non-commercial projects, please credit Kim

# ship image
ship_info = ImageInfo([45, 45], [90, 90], 35)
ship_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/lathrop/double_ship.png")

# sound assets purchased from sounddogs.com, please do not redistribute
ship_thrust_sound = simplegui.load_sound("http://commondatastorage.googleapis.com/codeskulptor-assets/sounddogs/thrust.mp3")

# ship class
class Ship:
	def __init__(self, pos, vel, angle, image, info):
		self.pos = [pos[0], pos[1]]
		self.vel = [vel[0], vel[1]]
		self.thrust = False
		self.angle = angle
		self.angle_vel = 0
		self.image = image
		self.image_centre = info.get_centre()
		self.image_size = info.get_size()
开发者ID:terrysky18,项目名称:Python-repo,代码行数:31,代码来源:spaceship_exp.py


示例6: collide

        self.age += 1
        if (self.pos[0] < 0)  or (self.pos[0] > WIDTH) or (self.age >= self.lifespan):
            return True
        else:
            return False
        
    def collide(self, other_object):
        dis = dist(self.get_position(), other_object.get_position())
        if dis <= self.get_radius() + other_object.get_radius():
            return True
        else:
            return False

# image and sound resource
background_info = ImageInfo([383, 165], [766, 330])
background_image = simplegui.load_image("http://d2.freep.cn/3tb_140711132516amq1535025.png")

splash_info = ImageInfo([286, 90], [572, 180])
splash_image = simplegui.load_image("http://d2.freep.cn/3tb_1407111325231o85535025.png")

gameover_info = ImageInfo([163, 147], [327, 294])
gameover_image = simplegui.load_image("http://d2.freep.cn/3tb_140711132519y8e8535025.png")

zombie_info = ImageInfo([32, 50], [64, 100], 20, True, 15)
zombie_image = simplegui.load_image("http://d2.freep.cn/3tb_140711132515f08j535025.png")

zombie1_info = ImageInfo([47.5, 56], [95, 112], 22, True, 17)
zombie1_image = simplegui.load_image("http://d2.freep.cn/3tb_140711132528kiko535025.png")

shooter_info = ImageInfo([28.5, 32], [55.5, 64], 20, True, 15)
shooter_image = simplegui.load_image("http://d3.freep.cn/3tb_140711132521gb83535025.png")
开发者ID:wzmdream,项目名称:similarity_check,代码行数:31,代码来源:pvz1.py


示例7:

# -*- coding: utf-8 -*-

import simpleguitk as simplegui
import random

## 定义常量
# 画布的尺寸
WIDTH = 800
HEIGHT = 600

# 骨牌的尺寸、中心位置及所有骨牌的图像
DOMINO_SIZE = (70, 190)
DOMINO_CENTER = (35, 95)
domino_images = simplegui.load_image("http://www.goldata.biz/images/dominoes.png")

# 所有骨牌。文牌是成对的,武牌是独一无二的。
DOMINOES = ('TIAN', 'TIAN', 'DI', 'DI', 'REN', 'REN', 'HE', 'HE', 'MEI', 'MEI', 'CHANG', 'CHANG', \
            'BAN', 'BAN', 'FU', 'FU', 'HONG', 'HONG', 'GAO', 'GAO', 'LING', 'LING', \
            'JIU1', 'JIU2', 'BA1', 'BA2', 'QI1', 'QI2', 'WU1', 'WU2', 'ZHIZUN1', 'ZHIZUN2')

# 所有骨牌对应的点数
POINTS = {'TIAN':12, 'DI':2, 'REN':8, 'HE':4, 'MEI':10, 'CHANG':6, 'BAN':4, 'FU':11, 'HONG':10, \
          'GAO':7, 'LING':6, 'JIU1':9, 'JIU2':9, 'BA1':8, 'BA2':8, 'QI1':7, 'QI2':7, 'WU1':5, \
          'WU2':5, 'ZHIZUN1':6, 'ZHIZUN2':3}

# 对牌与其排位、名称
DOMINO_PATTERNS = {('ZHIZUN1', 'ZHIZUN2'):(1, '至尊宝'), ('TIAN', 'TIAN'):(2, '双天'), ('DI', 'DI'):(3, '双地'), \
                   ('REN', 'REN'):(4, '孖人'), ('HE', 'HE'):(5, '孖和'), ('MEI', 'MEI'):(6, '孖梅'), \
                   ('CHANG', 'CHANG'):(7, '孖长'), ('BAN', 'BAN'):(8, '孖板凳'), ('FU', 'FU'):(9, '孖斧头'), \
                   ('HONG', 'HONG'):(10, '孖红头'), ('GAO', 'GAO'):(11, '孖高脚'), ('LING', 'LING'):(12, '孖零霖'), \
                   ('JIU1', 'JIU2'):(13, '杂九'), ('BA1', 'BA2'):(14, '杂八'), ('QI1', 'QI2'):(15, '杂七'), \
开发者ID:wzmdream,项目名称:similarity_check,代码行数:31,代码来源:paijiu_solution.py


示例8: click

__author__ = 'expressyang'
"""
简易放大镜
"""
import simpleguitk as simplegui


MAP_WIDTH = 2000
MAP_HEIGHT = 1818
#map_image = simplegui.load_image("http://ads.xjts.cn/zt/xj_map/images/1.jpg")
map_image = simplegui.load_image("1.jpg")
# 常量
MAP_SCALE = 3
CANVAS_WIDTH = MAP_WIDTH / MAP_SCALE
CANVAS_HEIGHT = MAP_HEIGHT / MAP_SCALE
MAGNIFIER_SIZE = 120

# Event handlers
def click(pos):
    magnifier_center[0] = pos[0]
    magnifier_center[1] = pos[1]

def drag(pos):
    magnifier_center[0] = pos[0]
    magnifier_center[1] = pos[1]

def draw(canvas):
    # 绘制图片
    canvas.draw_image(map_image, (MAP_WIDTH / 2, MAP_HEIGHT / 2), (MAP_WIDTH, MAP_HEIGHT),
                     (CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2), (CANVAS_WIDTH, CANVAS_HEIGHT))
开发者ID:wzmdream,项目名称:similarity_check,代码行数:30,代码来源:magnifier.py


示例9: toggle

import math
from datetime import datetime

# 全局变量
interval = 1000  # 时间事件处理器触发的周期,1秒
hour = 0.0
minute = 0.0
second = 0.0
hour_radian = 0.0
minute_radian = 0.0
second_radian = 0.0
digit_date = ""
digit_time = ""
display_digit = False

clock_face = simplegui.load_image("images/ClockFace.jpg")
hour = simplegui.load_image("images/Hour.png")
minute = simplegui.load_image("images/Minute.png")
second = simplegui.load_image("images/Second.png")


# 定义按钮的事件处理函数
def toggle():
    global display_digit
    display_digit = not display_digit
    if display_digit:
        button.set_text("关闭数显")
    else:
        button.set_text("开启数显")

开发者ID:wzmdream,项目名称:similarity_check,代码行数:29,代码来源:Clock.py


示例10: get_size

        return self.center

    def get_size(self):
        return self.size

    def get_radius(self):
        return self.radius

    def get_lifespan(self):
        return self.lifespan

    def get_animated(self):
        return self.animated

grassland_info = ImageInfo([960, 600], [1920, 1200])
grassland_image = simplegui.load_image("resources/grassland.jpg") # 地面背景
arrow_info = ImageInfo([21, 5], [42, 10],5,60)
arrow_image = simplegui.load_image("resources/arrow.png")         # 箭
castle_info = ImageInfo([54, 52], [109, 105],50)
castle_image = simplegui.load_image("resources/castle.png")       # 城堡
enemy_info = ImageInfo([32, 15], [64, 29], 15, 1000, True)
enemy_image = simplegui.load_image("resources/enemy.png")         # 敌人,图像文件中包含4副图片用来实现动画
soldier_info = ImageInfo([32, 26], [64, 52])
soldier_image = simplegui.load_image("resources/soldier.png")     # 战士,图像文件中包含2副图片用来实现动画
win_info = ImageInfo([320, 240], [640, 480])
win_image = simplegui.load_image("resources/win.png")             # 游戏成功
gameover_info = ImageInfo([320, 240], [640, 480])
gameover_image = simplegui.load_image("resources/gameover.png")   # 游戏结束
explosion_info = ImageInfo([64, 64], [128, 128], 17, 24, True)
explosion_image = simplegui.load_image("resources/explosion.png") # 爆炸,图像文件中包含多副图片用来实现动画
开发者ID:wzmdream,项目名称:similarity_check,代码行数:30,代码来源:HomeGuard.py


示例11: newgame

import random

#定义全局变量
WIDTH = 400
HEIGHT = 400               #画布高度和宽度 
image_size= [60,60]        #手势图像高度和宽度
gesture_image = []         # 3张手势图片
choice_image = []          # 显示的2张出拳的图片 
#index_image = [0,1,2]
turns = 0                  #表示局数
score1,score2 = 0, 0       #得分
started = False            #控制是否进入游戏界面
mouse_pos =(0,0)
message = ""               #屏幕上显示输赢的信息 

background1_image = simplegui.load_image("images\\background1.png")
background2_image = simplegui.load_image("images\\background2.png")
start_image = simplegui.load_image("images\\start.png")
gesture_image.append(simplegui.load_image("images\\scissors.png"))
gesture_image.append(simplegui.load_image("images\\stone.png"))
gesture_image.append(simplegui.load_image("images\\cloth.png"))
choice_image.append(simplegui.load_image("images\\stone.png"))
choice_image.append(simplegui.load_image("images\\stone.png"))
background_sound = simplegui.load_sound("sound\\sound1.ogg")
# 定义函数

#定义事件处理函数
def newgame():
    global turns, score1, score2, message 
    turns = 0
    score1,score2 = 0, 0
开发者ID:wzmdream,项目名称:similarity_check,代码行数:31,代码来源:fingerGuess.py


示例12:


# 创建窗口
# 16强共32张图片,每个图片的显示大小为128x128像素
# 32张图片显示为4行8列,因此窗口的宽度为128x8=1024像素,高度为128x4=512像素
frame = simplegui.create_frame("2014巴西世界杯16强连连看", 1024, 512)
frame.add_button("重新开始", new_game, 100)
label = frame.add_label("回合次数 = 0")

# 注册事件处理函数
frame.set_mouseclick_handler(mouseclick)
frame.set_draw_handler(draw)


# 读取图片
logo_image = simplegui.load_image("images\\Logo.png")
flag_image.append(simplegui.load_image("images\\Algeria.png"))
flag_image.append(simplegui.load_image("images\\Argentina.png"))
flag_image.append(simplegui.load_image("images\\Belgium.png"))
flag_image.append(simplegui.load_image("images\\Brazil.png"))
flag_image.append(simplegui.load_image("images\\Chile.png"))
flag_image.append(simplegui.load_image("images\\Colombia.png"))
flag_image.append(simplegui.load_image("images\\Costa-rica.png"))
flag_image.append(simplegui.load_image("images\\France.png"))
flag_image.append(simplegui.load_image("images\\Germany.png"))
flag_image.append(simplegui.load_image("images\\Greece.png"))
flag_image.append(simplegui.load_image("images\\Mexico.png"))
flag_image.append(simplegui.load_image("images\\Netherlands.png"))
flag_image.append(simplegui.load_image("images\\Nigeria.png"))
flag_image.append(simplegui.load_image("images\\Switzerland.png"))
flag_image.append(simplegui.load_image("images\\Uruguay.png"))
开发者ID:wzmdream,项目名称:similarity_check,代码行数:29,代码来源:WorldCupMemory.py


示例13: get_radius

    def get_radius(self):
        return self.radius

    def get_lifespan(self):
        return self.lifespan

    def get_animated(self):
        return self.animated


# debris images - debris1_brown.png, debris2_brown.png, debris3_brown.png, debris4_brown.png
#                 debris1_blue.png, debris2_blue.png, debris3_blue.png, debris4_blue.png, debris_blend.png
debris_info = ImageInfo([320, 240], [640, 480])
debris_image = simplegui.load_image(
    "https://raw.githubusercontent.com/EduIbanez/introduction-programming-python/master/mini-project-7/images/debris2_blue.png"
)

# nebula images - nebula_brown.png, nebula_blue.png
nebula_info = ImageInfo([400, 300], [800, 600])
nebula_image = simplegui.load_image(
    "https://raw.githubusercontent.com/EduIbanez/introduction-programming-python/master/mini-project-7/images/nebula_blue.png"
)

# splash image
splash_info = ImageInfo([200, 150], [400, 300])
splash_image = simplegui.load_image(
    "https://raw.githubusercontent.com/EduIbanez/introduction-programming-python/master/mini-project-7/images/splash.png"
)

# ship image
开发者ID:EduIbanez,项目名称:introduction-programming-python,代码行数:30,代码来源:ricerocks.py


示例14: draw

"""
The explosion example in code skulptor
"""
import simpleguitk as simplegui

EXPLOSION_CENTRE = [50, 50]
EXPLOSION_SIZE = [100, 100]
EXPLOSION_DIM = [9, 9]

explosion_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/explosion.hasgraphics.png")

# create timer that iterate current_sprite_centre through sprite
time = 0

# define draw handler
def draw(canvas):
	global time
	explosion_index = [time % EXPLOSION_DIM[0], (time // EXPLOSION_DIM[0]) % EXPLOSION_DIM[1]]
	canvas.draw_image(explosion_image,
			[EXPLOSION_CENTRE[0] + explosion_index[0] * EXPLOSION_SIZE[0],
			EXPLOSION_CENTRE[1] + explosion_index[1] * EXPLOSION_SIZE[1]],
			EXPLOSION_SIZE, EXPLOSION_CENTRE, EXPLOSION_SIZE)
	time += 1
# end of draw()

# create frame and size frame based on 100x100 pixel sprite
frame = simplegui.create_frame("Asteroid sprite", EXPLOSION_SIZE[0], EXPLOSION_SIZE[1])

# set draw handler and canvas background using custom HTML colour
frame.set_draw_handler(draw)
frame.set_canvas_background("blue")
开发者ID:terrysky18,项目名称:Python-repo,代码行数:31,代码来源:explode_example.py


示例15: __init__

# demo for drawing using tiled images

import simpleguitk as simplegui

# define globals for cards
RANKS = ('A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K')
SUITS = ('C', 'S', 'H', 'D')

# card sprite - 950x392
CARD_CENTER = (36.5, 49)
CARD_SIZE = (73, 98)
card_image = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/cards.jfitz.png")



# define card class
class Card:
    def __init__(self, suit, rank):
        self.rank = rank
        self.suit = suit

    def draw(self, canvas, loc):
        i = RANKS.index(self.rank)
        j = SUITS.index(self.suit)
        card_pos = [CARD_CENTER[0] + i * CARD_SIZE[0],
                    CARD_CENTER[1] + j * CARD_SIZE[1]]
        canvas.draw_image(card_image, card_pos, CARD_SIZE, loc, CARD_SIZE)

# define draw handler        
def draw(canvas):
    one_card.draw(canvas, (155, 90))
开发者ID:ltp19930730,项目名称:Python,代码行数:31,代码来源:tile_image.py


示例16:


# 创建窗口
# 8强共16张图片,每个图片的显示大小为128x128像素
# 16张图片显示为4行4列,因此窗口的宽度为128x4=512像素,高度为128x4=512像素
frame = simplegui.create_frame("2014巴西世界杯8强连连看", 512, 512)
frame.add_button("重新开始", new_game, 100)
label = frame.add_label("回合次数 = 0")

# 注册事件处理函数
frame.set_mouseclick_handler(mouseclick)
frame.set_draw_handler(draw)


# 读取图片
background_image = simplegui.load_image("images/background.png")
logo_image = simplegui.load_image("images/Logo.png")
flag_image.append(simplegui.load_image("images/Argentina.png"))
flag_image.append(simplegui.load_image("images/Belgium.png"))
flag_image.append(simplegui.load_image("images/Brazil.png"))
flag_image.append(simplegui.load_image("images/Colombia.png"))
flag_image.append(simplegui.load_image("images/Costa-rica.png"))
flag_image.append(simplegui.load_image("images/France.png"))
flag_image.append(simplegui.load_image("images/Germany.png"))
flag_image.append(simplegui.load_image("images/Netherlands.png"))

# 读取世界杯之歌
background_sound = simplegui.load_sound("sound/We_Are_One.ogg")
# 启动游戏
new_game()
frame.start()
开发者ID:wzmdream,项目名称:similarity_check,代码行数:29,代码来源:WorldCupTop8.py


示例17:

voiceover = ''
rule = '大规则:同花顺>铁支(四张相同)>葫芦(三带二)>同花>顺子>三条>两对>对子>散牌'
m_win_num = 0
p_win_num = 0
side_flag = ''
p_total_money = 10000
m_total_money = 1000000
bet_money = 0
p_bet_money = 100
m_bet_money = 100
p_is_bet = False
m_is_bet = False
# Source
CARD_SIZE = (72, 111)                 #加载图片资料
CARD_CENTER = (36, 55.5)
card_images = simplegui.load_image("image\\card.png")

CARD_BACK_SIZE = [72, 111]             #加载扑克背面图片
CARD_BACK_CENTER = [36, 55.5]
card_back = simplegui.load_image("image\\back.png")


background_size = [808, 606]           #加载开始前背景图片
background_center = [404, 303]
background_image = simplegui.load_image("image\\shguize1.png")

# initialize some useful global variables
in_play, stand_flag, bet_flag, flag= False, False, False, -1
value = -1
total = 0
pos = [140, 180]
开发者ID:wzmdream,项目名称:similarity_check,代码行数:31,代码来源:study.py


示例18: get_lifespan

    def get_lifespan(self):
        return self.lifespan

    def get_animated(self):
        return self.animated

    
# art assets created by Kim Lathrop, may be freely re-used in non-commercial projects, please credit Kim
    
# debris images - debris1_brown.png, debris2_brown.png, debris3_brown.png, debris4_brown.png
#                 debris1_blue.png, debris2_blue.png, debris3_blue.png, debris4_blue.png, debris_blend.png
debris_info = ImageInfo([320, 240], [640, 480])
debris_image_url = {'local' : "E:\MyDropbox\Photos\spaceship\debris2_blue.png",
                    'web' : "https://dl.dropbox.com/s/ltii3ztqgesc8kk/debris2_blue.png"}
debris_image = simplegui.load_image(debris_image_url[mode])

# nebula images - nebula_brown.png, nebula_blue.png
nebula_info = ImageInfo([400, 300], [800, 600])
nebula_image = simplegui.load_image("https://dl.dropbox.com/s/1b8nkxdedap16kc/nebula_blue.s2014.png")

# splash image
splash_info = ImageInfo([200, 150], [400, 300])
splash_image = simplegui.load_image("https://dl.dropbox.com/s/vkcje1kj1kzfrgp/splash.png")

# ship image
ship_info = ImageInfo([45, 45], [90, 90], 35)
ship_image = simplegui.load_image("https://dl.dropbox.com/s/8l4zmm1ez6lyqnb/double_ship.png")

# missile image - shot1.png, shot2.png, shot3.png
missile_info = ImageInfo([5,5], [10, 10], 3, 50)
开发者ID:tdongsi,项目名称:python,代码行数:30,代码来源:RiceRocks.py


示例19: set

# user interface
score = 0
lives = 3
time = 0.5
gameover = False
started = False
explosion_group = set()
rock_group = set()
bonus_group = set()

# game
missile = False

#  ------------- IMAGES ---------------------------#
debris_info = ImageInfo([320, 240], [640, 480])
debris_image = simplegui.load_image(DEBRIS)

# nebula images - nebula_brown.png, nebula_blue.png
nebula_info = ImageInfo([400, 300], [800, 600])
nebula_image = simplegui.load_image(NEBULA)
# splash image
splash_info = ImageInfo([200, 150], [400, 300])
splash_image = simplegui.load_image(SPLASH)
gameover_image = simplegui.load_image(GAMEOVER)
# ship image
ship_info = ImageInfo([45, 45], [90, 90], 35)
ship_image = simplegui.load_image(SHIP)

debris_image = simplegui.load_image(DEBRIS)
# nebula images - nebula_brown.png, nebula_blue.png
nebula_info = ImageInfo([400, 300], [800, 600])
开发者ID:ErisoHV,项目名称:Asteroids,代码行数:31,代码来源:Asteroids.py


示例20: new_game

# input will come from buttons and an input field
# all output for the game will be printed in the console

import simpleguitk as simplegui # 简单用户图形界面接口
import random    # 用random.randrange(start, stop)随机产生秘密的房间号
import math      # 用math.log(x, base)计算猜中所需的最少次数

# 初始化全局变量
secret_number = 1    # 每个回合计算机随机产生的秘密数字
remaining_guesses =0 # 一个回合剩余的猜测次数
range_low = 1        # 秘密房间号的下限
range_high = 25     # 秘密房间号的上限
canvas_height = 500                   # 画布高度,单位为像素
canvas_width = 500                    # 画布宽度,单位为像素
room_list = []                        # 所有房间,
cat_image = simplegui.load_image("cat.png")
# 启动或重新启动游戏的辅助函数
def new_game():
    global secret_number
    global remaining_guesses
    global room_list
    secret_number = random.randrange(range_low, range_high + 1)
    remaining_guesses = int(math.ceil(math.log(range_high, 2)))
    print()  # 为新一轮游戏输出一空白行,以便和上一轮游戏的输出分开
    print("新一轮游戏开始")
    print("你应当在%s和%s之间猜测一个数字" % (range_low, range_high))
    print("你还剩%s次猜测机会!" % remaining_guesses)
    print("请输入你猜测的房间号并按回车键")

    room_list = []
    for i in range(range_high):
开发者ID:wzmdream,项目名称:similarity_check,代码行数:31,代码来源:GuessRoomNumber.py



注:本文中的simpleguitk.load_image函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python simplejson.dump函数代码示例发布时间:2022-05-27
下一篇:
Python simpleguitk.create_timer函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap