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


Python Match.score方法代码示例

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


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

示例1: My_Boggle

# 需要导入模块: from match import Match [as 别名]
# 或者: from match.Match import score [as 别名]
class My_Boggle(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        # countdown
        self.remaining = 0
        self.grid()
        self.game_time = 180
        self.file = "alpha3/"
        # background image
        background_image = tk.PhotoImage(file="background2d.ppm")
        background_label = tk.Label(self, image=background_image)
        self.image = background_image
        background_label.place(x=0, y=0, relwidth=1, relheight=1)
        # radiobutton
        self._option_frame = tk.Frame(self, bg="royalblue3")
        self.start_button = tk.Button(self._option_frame, text="START",
                                      state="disabled", bg="royalblue2",
                                      command=self._start_)
        self.select = tk.Label(self._option_frame, text="SELECT",
                               bg="royalblue3")
        self.select.grid(row=0, column=0)
        self.R1 = tk.Radiobutton(self._option_frame,
                                 text="Simple Green (Easy)    ", value=1,
                                 command=lambda: self.set_difficulty(0),
                                 bg="SteelBlue2", bd=0)
        self.R1.grid(row=1, column=0)
        self.R1.deselect()
        self.R2 = tk.Radiobutton(self._option_frame,
                                 text="Crazy Colors (Hard)      ", value=2,
                                 command=lambda: self.set_difficulty(1),
                                 bg="SteelBlue2", bd=0)
        self.R2.grid(row=2, column=0)
        self.R2.deselect()
        self.start_button.grid(row=9, column=0)
        self._option_frame.grid(row=6, column=5)
        # computer guess time slider
        self._time_slider = tk.Scale(self._option_frame, from_=1, to=10,
                                     orient='horizontal',
                                     tickinterval=1, length=162,
                                     label="Computer Guess (seconds)",
                                     bg="cornflower blue",
                                     troughcolor="grey")
        self._time_slider.set(7)
        self._time_slider.grid(row=8, column=0)
        self.turn_delay = self._time_slider.get() * 1000
        # win
        self.user_win = tk.Frame(self, width=200, height=200)
        self.win = tk.Label(self.user_win, text="\nYou WIN!\n")
        self.win.grid(row=0, column=0)
        # lose
        self.user_lost = tk.Frame(self, width=200, height=200)
        self.lose = tk.Label(self.user_lost, text="\nYou Lost!\n")
        self.lose.grid(row=0, column=0)
        # tie
        self.user_tie = tk.Frame(self, width=200, height=200)
        self.tie = tk.Label(self.user_tie, text="\nTie Game!\n")
        self.tie.grid(row=0, column=0)
        # print unguessed words
        self._unguessed_frame = tk.Frame(self, bg="royalblue3")
        # remaining words
        self._option_frame2 = tk.Frame(self, width=200, height=200,
                                       bg="royalblue3")
        self.remaining = tk.Label(self._option_frame2, bg="royalblue3",
                                  text="\nWords Remaining:", font="bold")
        self.remain = tk.StringVar()
        self.select3 = tk.Label(self._option_frame2, textvariable=self.remain)
        self.remaining.grid(row=0, column=0)
        self.select3.grid(row=1, column=0)
        # score
        self._p1_score_frame = tk.Frame(self)
        self._p1_score_label = tk.Label(self._p1_score_frame, text='Score:')
        self._cmp_score_frame = tk.Frame(self)
        self._cmp_score_label = tk.Label(self._cmp_score_frame, text='Score:')
        self.score_cmp = tk.StringVar()
        self.score_cmp.set(0)
        self.score_p1 = tk.StringVar()
        self.score_p1.set(0)
        self._p1_score = tk.Label(self._p1_score_frame,
                                  textvariable=self.score_p1, bg='white')
        self._p1_score_label.grid(row=0, column=0)
        self._cmp_score = tk.Label(self._cmp_score_frame,
                                   textvariable=self.score_cmp, bg='white')
        self._cmp_score_label.grid(row=0, column=0)
        self._p1_score.grid(row=0, column=1)
        self._cmp_score.grid(row=0, column=1)
        # dice
        self._dice_frame = tk.Frame(self, bg="white")
        self._quit_frame = tk.Frame(self)
        self._time_frame = tk.Frame(self)
        self._time_label = tk.Label(self._time_frame, text="", width=10,
                                    relief="sunken")
        self._time_label.grid(row=0, column=0)
        self._user_frame = tk.Frame(self, bd=2, bg="light blue")
        # user and computer input windows
        self._guess1_frame = tk.Frame(self, bd=2, bg="red")
        self._guess2_frame = tk.Frame(self, bd=2, bg="green")
        self._computer = tk.Label(self._guess1_frame, text='Computer')
        self._user = tk.Label(self._guess2_frame, text='Player 1')
        self._computer_text = tk.Text(self._guess1_frame, width=10,
                                      height=25, bg='white', bd=2)
#.........这里部分代码省略.........
开发者ID:Ragnok,项目名称:boggle,代码行数:103,代码来源:gui.py


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