This repository was archived by the owner on Apr 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttons.py
More file actions
53 lines (36 loc) · 1.39 KB
/
buttons.py
File metadata and controls
53 lines (36 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from io import *
from tkinter import messagebox
import tkinter
class Button():
def __init__(self, where, name, row, column):
self.name = name
name = tkinter.Button(where, text=name, command=self.showinfo)
name.grid(row=row, column=column, sticky="nsew", pady=2, padx=2)
if column == 0 and row == 0:
name.config(bg="#affc41")
elif column < 2:
name.config(bg="#90e0ef")
elif (column >= 3 and row == 7) or (column >= 3 and row == 8):
name.config(bg="#a3ddd0")
elif column >= 2 and column <= 11:
name.config(bg="light green")
elif column == 17:
name.config(bg="#ffe774")
elif (column >= 12 and column <=16) and row == 1:
name.config(bg="pink")
elif (column >= 13 and column <=16) and row == 2:
name.config(bg="pink")
elif (column >= 14 and column <=16) and row == 3:
name.config(bg="pink")
elif (column >= 15 and column <=16) and row == 4:
name.config(bg="pink")
elif column == 16 and row == 5:
name.config(bg="pink")
else:
name.config(bg="light yellow")
def readinfo(self):
info = open(("Elements/"+(self.name + ".txt")), "r")
return info.read()
def showinfo(self):
info = self.readinfo()
messagebox.showinfo(self.name, info)