Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Scrabble.py ZZZ
- from Tkinter import *
- root = Tk()
- root.resizable(0,0)
- root.title("Scrabble")
- root.geometry("%dx%d%+d%+d" % (250, 250, 1, 1))
- from random import randint, choice, shuffle
- from string import ascii_uppercase
- from sys import exit
- class Cv(): 0
- cv = Cv()
- # Tiles in "bag"
- global distribution
- distribution = list('aaaaaaaaabbccddddeeeeeeeeeeeeffggghhiiiiiiiiijkllllmmnnnnnnooooooooppqrrrrrrssssttttttuuuuvvwwxyyz??')
- #
- board = [
- ['TWS', ' ', ' ', 'DLS', ' ', ' ', ' ', 'TWS', ' ', ' ', ' ', 'DLS', ' ', ' ', 'TWS'],
- [' ', 'DWS', ' ', ' ', ' ', 'TLS', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'DWS', ' '],
- [' ', ' ', 'DWS', ' ', ' ', ' ', 'DLS', ' ', 'DLS', ' ', ' ', ' ', 'DWS', ' ', ' '],
- ['DLS', ' ', ' ', 'DWS', ' ', ' ', ' ', 'DLS', ' ', ' ', ' ', 'DWS', ' ', ' ', 'DLS'],
- [' ', ' ', ' ', ' ', 'DWS', ' ', ' ', ' ', ' ', ' ', 'DWS', ' ', ' ', ' ', ' '],
- [' ', 'TLS', ' ', ' ', ' ', 'TLS', ' ', ' ', ' ', 'TLS', ' ', ' ', ' ', 'TLS', ' '],
- [' ', ' ', 'DLS', ' ', ' ', ' ', 'DLS', ' ', 'DLS', ' ', ' ', ' ', 'DLS', ' ', ' '],
- ['TWS', ' ', ' ', 'DLS', ' ', ' ', ' ', ' * ', ' ', ' ', ' ', 'DLS', ' ', ' ', 'TWS'],
- [' ', ' ', 'DLS', ' ', ' ', ' ', 'DLS', ' ', 'DLS', ' ', ' ', ' ', 'DLS', ' ', ' '],
- [' ', 'TLS', ' ', ' ', ' ', 'TLS', ' ', ' ', ' ', 'TLS', ' ', ' ', ' ', 'TLS', ' '],
- [' ', ' ', ' ', ' ', 'DWS', ' ', ' ', ' ', ' ', ' ', 'DWS', ' ', ' ', ' ', ' '],
- ['DLS', ' ', ' ', 'DWS', ' ', ' ', ' ', 'DLS', ' ', ' ', ' ', 'DWS', ' ', ' ', 'DLS'],
- [' ', ' ', 'DWS', ' ', ' ', ' ', 'DLS', ' ', 'DLS', ' ', ' ', ' ', 'DWS', ' ', ' '],
- [' ', 'DWS', ' ', ' ', ' ', 'TLS', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'DWS', ' '],
- ['TWS', ' ', ' ', 'DLS', ' ', ' ', ' ', 'TWS', ' ', ' ', ' ', 'DLS', ' ', ' ', 'TWS']]
- scoreBonus = ['TWS', 'DWS', 'TLS', 'DLS']
- d = "0 ? 1 aeilnorstu 2 dg 3 bcmp 4 fhvwy 5 k 8 jx 10 qz".split(' ')
- scores = {}
- while d:
- s,p = d.pop(),d.pop()
- for v in s: scores[v] = int(p)
- colors = {"TWS":"light red", "DWS":"light purple", "TLS":"light green", "DLS":"light blue", "*":"dark yellow"}
- def exitGame():
- root.destroy()
- exit()
- root.config(bg='aqua')
- welcomeLabel = Label(root, text = "Welcome to Scrabble in Python!")
- instructionsButton = Button(root, text = "Instructions", command = instructions)
- playButton = Button(root, text = "Play", command = play)
- playSavedButton = Button(root, text = "Play Saved Game", command = playSavedGame)
- exitButton = Button(root, text = "Exit", command = exitGame)
- welcomeLabel.place(x = 40, y = 20)
- instructionsButton.place(x = 40, y = 60)
- playButton.place(x = 40, y = 90)
- playSavedButton.place(x = 40, y = 120)
- exitButton.place(x = 40, y = 150)
- words = "" # pastebin: sorry, previous went over 512kb limit
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement