当前位置: 首页>>代码示例>>Python>>正文


Python Main.images方法代码示例

本文整理汇总了Python中main.Main.images方法的典型用法代码示例。如果您正苦于以下问题:Python Main.images方法的具体用法?Python Main.images怎么用?Python Main.images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在main.Main的用法示例。


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

示例1: Create_Main

# 需要导入模块: from main import Main [as 别名]
# 或者: from main.Main import images [as 别名]
def Create_Main():
    root = Tk()
    root.geometry("1280x700")
    root.resizable(0, 0)  # Code to ensure that the window did not resize.
    root.title("Main")  # Set Main Title.

    font = ("Forte", 12)

    bkg = PhotoImage(file="Imgs/background2.gif")
    bkg_lbl = Label(root, image=bkg)
    bkg_lbl.place(x=0, y=0, relwidth=1, relheight=1)

    lbl_1 = Label(root, text="Player 1", font=font, bg="White", fg="gray")
    lbl_1.place(x=180, y=130)

    lbl_1 = Label(root, text="Player 2", font=font, bg="White", fg="gray")
    lbl_1.place(x=950, y=130)



# --------------------------- Barras de Estado ------------------------

    Bar_Turno = StatusBar(root)

    Bar_Turno.set("Turno: %s", "Jugador 1")
    Bar_Turno.pack(padx=30, pady=65)

    Bar_Tiros_Player1 = StatusBar(root)
    Bar_Tiros_Player2 = StatusBar(root)
    Bar_Tiros_Player1.place(x=265, y=130)
    Bar_Tiros_Player2.place(x=1040, y=130)

    Bar_Tiros_Acert_Play1 = StatusBar(root)
    Bar_Tiros_Acert_Play2 = StatusBar(root)
    Bar_Tiros_Acert_Play1.place(x=365, y=130)
    Bar_Tiros_Acert_Play2.place(x=1145, y=130)


    Bar_Tiros_Player1.set("Tiros Totales: %s", "0")
    Bar_Tiros_Player2.set("Tiros Totales: %s", "0")

    Bar_Tiros_Acert_Play1.set("Tiros Acertados: %s", "0")
    Bar_Tiros_Acert_Play2.set("Tiros Acertados: %s", "0")


    frm_2 = Frame(root, width=520, height=520, bd=-2, bg="gray")
    frm_1 = Frame(root, width=520, height=520, bd=-2, bg="gray")

    frm_1.pack(side=LEFT)
    #frm_1.pack_propagate(0)

    frm_2.pack(side=RIGHT)

    def dialog_cons(n, msg):
        """

            :rtype : object
            """
        widg = Dialog(root, n)
        root.wait_window(widg.top)
        while widg.result == "":
            if msg != None:
                messagebox.showinfo("Warning!", msg)
            else:
                messagebox.showinfo("Warning!", "Please insert the name for the %s Player!" % n)
            widg = Dialog(root, n)
            root.wait_window(widg.top)
        return widg.result

    OneTwoPlayer = messagebox.askyesno("Player or PC", "Do you want to play with other human? (No = PC)")
    if OneTwoPlayer == 1:
        player1 = dialog_cons(1, None)
        player2 = dialog_cons(2, None)
        print(player1, player2)    # Testing Lines
    else:
        player1 = dialog_cons(1, None)
        player2 = "Computer"
        print(player1, player2)    # Testing Lines

    try:
        ships = int(dialog_cons("Ships", "Please Quantity of ships for the Game!"))
    except ValueError:
        messagebox.showinfo("Warning!", "La variable debe ser numero")
        ships = int(dialog_cons("Ships", "Please Quantity of ships for the Game!"))
    print(ships)    # Testing Lines

    try:
        xy = int(dialog_cons("Quantity of matrix: (Ej: nxn, insert n)", "Please insert the size for Game's matrix!"))
    except ValueError:
        messagebox.showinfo("Warning!", "La variable debe ser numero!")
        xy = int(dialog_cons("Ships", "Please Quantity of ships for the Game!"))
    print(xy)    # Testing Lines

    game = Main(player1, player2, xy, xy, ships)
    game.imprimir
    game.imprimir2
    game.images(frm_1, game.matrix_shoots_player_1, game.matrix_player_1)
    game.images(frm_2, game.matrix_shoots_comp_player_2, game.matrix_comp_player_2)


#.........这里部分代码省略.........
开发者ID:Ginko-san,项目名称:Batleship_Game,代码行数:103,代码来源:Interface.py


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