Hello I am trying to create a game where you click on a button and it tells you if it is treasure or a bandit. It if is treasure then you get points if it is a bandit you loose your coins. I have created the following code but cannot find a way of finding out if I have managed to set the buttons to the values stored in the array. How do you use the data in the array and when a button is clicked it tells you what the value is. Am I doing the array correctly any help would be appreciated I am going round in circles and cannot think straight now.
from tkinter import *
import tkinter.messagebox
import random
#count=0
root = Tk()
TreasureMap = Frame(root)
TreasureMap.grid()
root.title("TreasureMap")
text_box = Entry(TreasureMap, justify=RIGHT)
text_box.grid(row = 0, column = 0, columnspan = 8,)
text_box.insert(0, "0")
amount_to_add='B'
my_array = [[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0]]
my_array[random.randrange(len(my_array))].append(amount_to_add)
my_array[random.randrange(len(my_array))].append(amount_to_add)
my_array[random.randrange(len(my_array))].append(amount_to_add)
my_array[random.randrange(len(my_array))].append(amount_to_add)
Treasure='T'
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
my_array[random.randrange(len(my_array))].append(Treasure)
print(my_array)
def changelabel(): `
tkinter.messagebox.showinfo('Hellow this button works') ``
print('hello this button works') ` ``
print(my_array) `` ``
return
i = 0
bttn = []
for j in range(1,9):`
for k in range(8): ``
bttn.append(Button(TreasureMap, text = ' ', value=random.shuffle
(my_array),command=changelabel))
bttn[i].grid(row = j, column = k)
i += 1 ``
TreasureMap.mainloop()