# Written by D Walker July 2014

from Tkinter import *
import ttk
import serial
import time
import threading

def init(root):
    root.title('ScR DAM (TDM) SIMULATOR v1.0 with COS - 448 Functions')

port = serial.Serial("/dev/ttyAMA0", baudrate=1200, parity='O', writeTimeout=0)

# Scan each byte

def scan0():
    global b_0
    b_0 = (b0_0var.get()) + (b0_1var.get()) + (b0_2var.get()) + (b0_3var.get()) + (b0_4var.get()) + (b0_5var.get()) + (b0_6var.get()) + (b0_7var.get())

def scan1():
    global b_1
    b_1 = (b1_0var.get()) + (b1_1var.get()) + (b1_2var.get()) + (b1_3var.get()) + (b1_4var.get()) + (b1_5var.get()) + (b1_6var.get()) + (b1_7var.get())

def scan2():
    global b_2
    b_2 = (b2_0var.get()) + (b2_1var.get()) + (b2_2var.get()) + (b2_3var.get()) + (b2_4var.get()) + (b2_5var.get()) + (b2_6var.get()) + (b2_7var.get())

def scan3():
    global b_3
    b_3 = (b3_0var.get()) + (b3_1var.get()) + (b3_2var.get()) + (b3_3var.get()) + (b3_4var.get()) + (b3_5var.get()) + (b3_6var.get()) + (b3_7var.get())

def scan4():
    global b_4
    b_4 = (b4_0var.get()) + (b4_1var.get()) + (b4_2var.get()) + (b4_3var.get()) + (b4_4var.get()) + (b4_5var.get()) + (b4_6var.get()) + (b4_7var.get())

def scan5():
    global b_5
    b_5 = (b5_0var.get()) + (b5_1var.get()) + (b5_2var.get()) + (b5_3var.get()) + (b5_4var.get()) + (b5_5var.get()) + (b5_6var.get()) + (b5_7var.get())

def scan6():
    global b_6
    b_6 = (b6_0var.get()) + (b6_1var.get()) + (b6_2var.get()) + (b6_3var.get()) + (b6_4var.get()) + (b6_5var.get()) + (b6_6var.get()) + (b6_7var.get())

def scan7():
    global b_7
    b_7 = (b7_0var.get()) + (b7_1var.get()) + (b7_2var.get()) + (b7_3var.get()) + (b7_4var.get()) + (b7_5var.get()) + (b7_6var.get()) + (b7_7var.get())

def scan8():
    global b_8
    b_8 = (b8_0var.get()) + (b8_1var.get()) + (b8_2var.get()) + (b8_3var.get()) + (b8_4var.get()) + (b8_5var.get()) + (b8_6var.get()) + (b8_7var.get())

def scan9():
    global b_9
    b_9 = (b9_0var.get()) + (b9_1var.get()) + (b9_2var.get()) + (b9_3var.get()) + (b9_4var.get()) + (b9_5var.get()) + (b9_6var.get()) + (b9_7var.get())

def scan10():
    global b_10
    b_10 = (b10_0var.get()) + (b10_1var.get()) + (b10_2var.get()) + (b10_3var.get()) + (b10_4var.get()) + (b10_5var.get()) + (b10_6var.get()) + (b10_7var.get())

def scan11():
    global b_11
    b_11 = (b11_0var.get()) + (b11_1var.get()) + (b11_2var.get()) + (b11_3var.get()) + (b11_4var.get()) + (b11_5var.get()) + (b11_6var.get()) + (b11_7var.get())

def scan12():
    global b_12
    b_12 = (b12_0var.get()) + (b12_1var.get()) + (b12_2var.get()) + (b12_3var.get()) + (b12_4var.get()) + (b12_5var.get()) + (b12_6var.get()) + (b12_7var.get())

def scan13():
    global b_13
    b_13 = (b13_0var.get()) + (b13_1var.get()) + (b13_2var.get()) + (b13_3var.get()) + (b13_4var.get()) + (b13_5var.get()) + (b13_6var.get()) + (b13_7var.get())

def scan14():
    global b_14
    b_14 = (b14_0var.get()) + (b14_1var.get()) + (b14_2var.get()) + (b14_3var.get()) + (b14_4var.get()) + (b14_5var.get()) + (b14_6var.get()) + (b14_7var.get())

def scan15():
    global b_15
    b_15 = (b15_0var.get()) + (b15_1var.get()) + (b15_2var.get()) + (b15_3var.get()) + (b15_4var.get()) + (b15_5var.get()) + (b15_6var.get()) + (b15_7var.get())

def scan16():
    global b_16
    b_16 = (b16_0var.get()) + (b16_1var.get()) + (b16_2var.get()) + (b16_3var.get()) + (b16_4var.get()) + (b16_5var.get()) + (b16_6var.get()) + (b16_7var.get())

def scan17():
    global b_17
    b_17 = (b17_0var.get()) + (b17_1var.get()) + (b17_2var.get()) + (b17_3var.get()) + (b17_4var.get()) + (b17_5var.get()) + (b17_6var.get()) + (b17_7var.get())

def scan18():
    global b_18
    b_18 = (b18_0var.get()) + (b18_1var.get()) + (b18_2var.get()) + (b18_3var.get()) + (b18_4var.get()) + (b18_5var.get()) + (b18_6var.get()) + (b18_7var.get())

def scan19():
    global b_19
    b_19 = (b19_0var.get()) + (b19_1var.get()) + (b19_2var.get()) + (b19_3var.get()) + (b19_4var.get()) + (b19_5var.get()) + (b19_6var.get()) + (b19_7var.get())

def scan20():
    global b_20
    b_20 = (b20_0var.get()) + (b20_1var.get()) + (b20_2var.get()) + (b20_3var.get()) + (b20_4var.get()) + (b20_5var.get()) + (b20_6var.get()) + (b20_7var.get())

def scan21():
    global b_21
    b_21 = (b21_0var.get()) + (b21_1var.get()) + (b21_2var.get()) + (b21_3var.get()) + (b21_4var.get()) + (b21_5var.get()) + (b21_6var.get()) + (b21_7var.get())

def scan22():
    global b_22
    b_22 = (b22_0var.get()) + (b22_1var.get()) + (b22_2var.get()) + (b22_3var.get()) + (b22_4var.get()) + (b22_5var.get()) + (b22_6var.get()) + (b22_7var.get())

def scan23():
    global b_23
    b_23 = (b23_0var.get()) + (b23_1var.get()) + (b23_2var.get()) + (b23_3var.get()) + (b23_4var.get()) + (b23_5var.get()) + (b23_6var.get()) + (b23_7var.get())

def scan24():
    global b_24
    b_24 = (b24_0var.get()) + (b24_1var.get()) + (b24_2var.get()) + (b24_3var.get()) + (b24_4var.get()) + (b24_5var.get()) + (b24_6var.get()) + (b24_7var.get())

def scan25():
    global b_25
    b_25 = (b25_0var.get()) + (b25_1var.get()) + (b25_2var.get()) + (b25_3var.get()) + (b25_4var.get()) + (b25_5var.get()) + (b25_6var.get()) + (b25_7var.get())

def scan26():
    global b_26
    b_26 = (b26_0var.get()) + (b26_1var.get()) + (b26_2var.get()) + (b26_3var.get()) + (b26_4var.get()) + (b26_5var.get()) + (b26_6var.get()) + (b26_7var.get())

def scan27():
    global b_27
    b_27 = (b27_0var.get()) + (b27_1var.get()) + (b27_2var.get()) + (b27_3var.get()) + (b27_4var.get()) + (b27_5var.get()) + (b27_6var.get()) + (b27_7var.get())

def scan28():
    global b_28
    b_28 = (b28_0var.get()) + (b28_1var.get()) + (b28_2var.get()) + (b28_3var.get()) + (b28_4var.get()) + (b28_5var.get()) + (b28_6var.get()) + (b28_7var.get())

def scan29():
    global b_29
    b_29 = (b29_0var.get()) + (b29_1var.get()) + (b29_2var.get()) + (b29_3var.get()) + (b29_4var.get()) + (b29_5var.get()) + (b29_6var.get()) + (b29_7var.get())

def scan30():
    global b_30
    b_30 = (b30_0var.get()) + (b30_1var.get()) + (b30_2var.get()) + (b30_3var.get()) + (b30_4var.get()) + (b30_5var.get()) + (b30_6var.get()) + (b30_7var.get())

def scan31():
    global b_31
    b_31 = (b31_0var.get()) + (b31_1var.get()) + (b31_2var.get()) + (b31_3var.get()) + (b31_4var.get()) + (b31_5var.get()) + (b31_6var.get()) + (b31_7var.get())

def scan32():
    global b_32
    b_32 = (b32_0var.get()) + (b32_1var.get()) + (b32_2var.get()) + (b32_3var.get()) + (b32_4var.get()) + (b32_5var.get()) + (b32_6var.get()) + (b32_7var.get())

def scan33():
    global b_33
    b_33 = (b33_0var.get()) + (b33_1var.get()) + (b33_2var.get()) + (b33_3var.get()) + (b33_4var.get()) + (b33_5var.get()) + (b33_6var.get()) + (b33_7var.get())

def scan34():
    global b_34
    b_34 = (b34_0var.get()) + (b34_1var.get()) + (b34_2var.get()) + (b34_3var.get()) + (b34_4var.get()) + (b34_5var.get()) + (b34_6var.get()) + (b34_7var.get())

def scan35():
    global b_35
    b_35 = (b35_0var.get()) + (b35_1var.get()) + (b35_2var.get()) + (b35_3var.get()) + (b35_4var.get()) + (b35_5var.get()) + (b35_6var.get()) + (b35_7var.get())

def scan36():
    global b_36
    b_36 = (b36_0var.get()) + (b36_1var.get()) + (b36_2var.get()) + (b36_3var.get()) + (b36_4var.get()) + (b36_5var.get()) + (b36_6var.get()) + (b36_7var.get())

def scan37():
    global b_37
    b_37 = (b37_0var.get()) + (b37_1var.get()) + (b37_2var.get()) + (b37_3var.get()) + (b37_4var.get()) + (b37_5var.get()) + (b37_6var.get()) + (b37_7var.get())

def scan38():
    global b_38
    b_38 = (b38_0var.get()) + (b38_1var.get()) + (b38_2var.get()) + (b38_3var.get()) + (b38_4var.get()) + (b38_5var.get()) + (b38_6var.get()) + (b38_7var.get())

def scan39():
    global b_39
    b_39 = (b39_0var.get()) + (b39_1var.get()) + (b39_2var.get()) + (b39_3var.get()) + (b39_4var.get()) + (b39_5var.get()) + (b39_6var.get()) + (b39_7var.get())

def scan40():
    global b_40
    b_40 = (b40_0var.get()) + (b40_1var.get()) + (b40_2var.get()) + (b40_3var.get()) + (b40_4var.get()) + (b40_5var.get()) + (b40_6var.get()) + (b40_7var.get())

def scan41():
    global b_41
    b_41 = (b41_0var.get()) + (b41_1var.get()) + (b41_2var.get()) + (b41_3var.get()) + (b41_4var.get()) + (b41_5var.get()) + (b41_6var.get()) + (b41_7var.get())

def scan42():
    global b_42
    b_42 = (b42_0var.get()) + (b42_1var.get()) + (b42_2var.get()) + (b42_3var.get()) + (b42_4var.get()) + (b42_5var.get()) + (b42_6var.get()) + (b42_7var.get())

def scan43():
    global b_43
    b_43 = (b43_0var.get()) + (b43_1var.get()) + (b43_2var.get()) + (b43_3var.get()) + (b43_4var.get()) + (b43_5var.get()) + (b43_6var.get()) + (b43_7var.get())

def scan44():
    global b_44
    b_44 = (b44_0var.get()) + (b44_1var.get()) + (b44_2var.get()) + (b44_3var.get()) + (b44_4var.get()) + (b44_5var.get()) + (b44_6var.get()) + (b44_7var.get())

def scan45():
    global b_45
    b_45 = (b45_0var.get()) + (b45_1var.get()) + (b45_2var.get()) + (b45_3var.get()) + (b45_4var.get()) + (b45_5var.get()) + (b45_6var.get()) + (b45_7var.get())

def scan46():
    global b_46
    b_46 = (b46_0var.get()) + (b46_1var.get()) + (b46_2var.get()) + (b46_3var.get()) + (b46_4var.get()) + (b46_5var.get()) + (b46_6var.get()) + (b46_7var.get())

def scan47():
    global b_47
    b_47 = (b47_0var.get()) + (b47_1var.get()) + (b47_2var.get()) + (b47_3var.get()) + (b47_4var.get()) + (b47_5var.get()) + (b47_6var.get()) + (b47_7var.get())

def scan48():
    global b_48
    b_48 = (b48_0var.get()) + (b48_1var.get()) + (b48_2var.get()) + (b48_3var.get()) + (b48_4var.get()) + (b48_5var.get()) + (b48_6var.get()) + (b48_7var.get())

def scan49():
    global b_49
    b_49 = (b49_0var.get()) + (b49_1var.get()) + (b49_2var.get()) + (b49_3var.get()) + (b49_4var.get()) + (b49_5var.get()) + (b49_6var.get()) + (b49_7var.get())

def scan50():
    global b_50
    b_50 = (b50_0var.get()) + (b50_1var.get()) + (b50_2var.get()) + (b50_3var.get()) + (b50_4var.get()) + (b50_5var.get()) + (b50_6var.get()) + (b50_7var.get())

def scan51():
    global b_51
    b_51 = (b51_0var.get()) + (b51_1var.get()) + (b51_2var.get()) + (b51_3var.get()) + (b51_4var.get()) + (b51_5var.get()) + (b51_6var.get()) + (b51_7var.get())

def scan52():
    global b_52
    b_52 = (b52_0var.get()) + (b52_1var.get()) + (b52_2var.get()) + (b52_3var.get()) + (b52_4var.get()) + (b52_5var.get()) + (b52_6var.get()) + (b52_7var.get())

def scan53():
    global b_53
    b_53 = (b53_0var.get()) + (b53_1var.get()) + (b53_2var.get()) + (b53_3var.get()) + (b53_4var.get()) + (b53_5var.get()) + (b53_6var.get()) + (b53_7var.get())    

def scan54():
    global b_54
    b_54 = (b54_0var.get()) + (b54_1var.get()) + (b54_2var.get()) + (b54_3var.get()) + (b54_4var.get()) + (b54_5var.get()) + (b54_6var.get()) + (b54_7var.get())

def scan55():
    global b_55
    b_55 = (b55_0var.get()) + (b55_1var.get()) + (b55_2var.get()) + (b55_3var.get()) + (b55_4var.get()) + (b55_5var.get()) + (b55_6var.get()) + (b55_7var.get())

def scan56():
    global b_56
    b_56 = (b56_0var.get()) + (b56_1var.get()) + (b56_2var.get()) + (b56_3var.get()) + (b56_4var.get()) + (b56_5var.get()) + (b56_6var.get()) + (b56_7var.get())

def scan57():
    global b_57
    b_57 = (b57_0var.get()) + (b57_1var.get()) + (b57_2var.get()) + (b57_3var.get()) + (b57_4var.get()) + (b57_5var.get()) + (b57_6var.get()) + (b57_7var.get())

def scan58():
    global b_58
    b_58 = (b58_0var.get()) + (b58_1var.get()) + (b58_2var.get()) + (b58_3var.get()) + (b58_4var.get()) + (b58_5var.get()) + (b58_6var.get()) + (b58_7var.get())

def scan59():
    global b_59
    b_59 = (b59_0var.get()) + (b59_1var.get()) + (b59_2var.get()) + (b59_3var.get()) + (b59_4var.get()) + (b59_5var.get()) + (b59_6var.get()) + (b59_7var.get())

def scan60():
    global b_60
    b_60 = (b60_0var.get()) + (b60_1var.get()) + (b60_2var.get()) + (b60_3var.get()) + (b60_4var.get()) + (b60_5var.get()) + (b60_6var.get()) + (b60_7var.get())

def scan61():
    global b_61
    b_61 = (b61_0var.get()) + (b61_1var.get()) + (b61_2var.get()) + (b61_3var.get()) + (b61_4var.get()) + (b61_5var.get()) + (b61_6var.get()) + (b61_7var.get())

def scan62():
    global b_62
    b_62 = (b62_0var.get()) + (b62_1var.get()) + (b62_2var.get()) + (b62_3var.get()) + (b62_4var.get()) + (b62_5var.get()) + (b62_6var.get()) + (b62_7var.get())

def scan63():
    global b_63
    b_63 = (b63_0var.get()) + (b63_1var.get()) + (b63_2var.get()) + (b63_3var.get()) + (b63_4var.get()) + (b63_5var.get()) + (b63_6var.get()) + (b63_7var.get())


# Transmit

def Tx0():
    AD0 = 0xc0
    Message0=bytearray([b_0])
    Message0.insert(0, AD0)
    port.write(Message0)
    
def Tx1():
    AD1 = 0xc1
    Message1=bytearray([b_1])        
    Message1.insert(0, AD1)
    port.write(Message1)

def Tx2():
    AD2 = 0xc2
    Message2=bytearray([b_2])
    Message2.insert(0, AD2)
    port.write(Message2)

def Tx3():
    AD3 = 0xc3
    Message3=bytearray([b_3])
    Message3.insert(0, AD3)
    port.write(Message3)

def Tx4():
    AD4 = 0xc4
    Message4=bytearray([b_4])
    Message4.insert(0, AD4)
    port.write(Message4)

def Tx5():
    AD5 = 0xc5
    Message5=bytearray([b_5])
    Message5.insert(0, AD5)
    port.write(Message5)

def Tx6():
    AD6 = 0xc6
    Message6=bytearray([b_6])
    Message6.insert(0, AD6)
    port.write(Message6)

def Tx7():
    AD7 = 0xc7
    Message7=bytearray([b_7])
    Message7.insert(0, AD7)
    port.write(Message7)

def Tx8():
    AD8 = 0xc8
    Message8=bytearray([b_8])
    Message8.insert(0, AD8)
    port.write(Message8)

def Tx9():
    AD9 = 0xc9
    Message9=bytearray([b_9])
    Message9.insert(0, AD9)
    port.write(Message9)

def Tx10():
    AD10 = 0xca
    Message10=bytearray([b_10])
    Message10.insert(0, AD10)
    port.write(Message10)

def Tx11():
    AD11 = 0xcb
    Message11=bytearray([b_11])
    Message11.insert(0, AD11)
    port.write(Message11)

def Tx12():
    AD12 = 0xcc
    Message12=bytearray([b_12])
    Message12.insert(0, AD12)
    port.write(Message12)

def Tx13():
    AD13 = 0xcd
    Message13=bytearray([b_13])
    Message13.insert(0, AD13)
    port.write(Message13)

def Tx14():
    AD14 = 0xce
    Message14=bytearray([b_14])
    Message14.insert(0, AD14)
    port.write(Message14)

def Tx15():
    AD15 = 0xcf
    Message15=bytearray([b_15])
    Message15.insert(0, AD15)
    port.write(Message15)

def Tx16():
    AD16 = 0xd0
    Message16=bytearray([b_16])
    Message16.insert(0, AD16)
    port.write(Message16)

def Tx17():
    AD17 = 0xd1
    Message17=bytearray([b_17])
    Message17.insert(0, AD17)
    port.write(Message17)

def Tx18():
    AD18 = 0xd2
    Message18=bytearray([b_18])
    Message18.insert(0, AD18)
    port.write(Message18)

def Tx19():
    AD19 = 0xd3
    Message19=bytearray([b_19])
    Message19.insert(0, AD19)
    port.write(Message19)

def Tx20():
    AD20 = 0xd4
    Message20=bytearray([b_20])
    Message20.insert(0, AD20)
    port.write(Message20)

def Tx21():
    AD21 = 0xd5
    Message21=bytearray([b_21])
    Message21.insert(0, AD21)
    port.write(Message21)

def Tx22():
    AD22 = 0xd6
    Message22=bytearray([b_22])
    Message22.insert(0, AD22)
    port.write(Message22)

def Tx23():
    AD23 = 0xd7
    Message23=bytearray([b_23])
    Message23.insert(0, AD23)
    port.write(Message23)

def Tx24():
    AD24 = 0xd8
    Message24=bytearray([b_24])
    Message24.insert(0, AD24)
    port.write(Message24)

def Tx25():
    AD25 = 0xd9
    Message25=bytearray([b_25])
    Message25.insert(0, AD25)
    port.write(Message25)

def Tx26():
    AD26 = 0xda
    Message26=bytearray([b_26])
    Message26.insert(0, AD26)
    port.write(Message26)

def Tx27():
    AD27 = 0xdb
    Message27=bytearray([b_27])
    Message27.insert(0, AD27)
    port.write(Message27)

def Tx28():
    AD28 = 0xdc
    Message28=bytearray([b_28])
    Message28.insert(0, AD28)
    port.write(Message28)

def Tx29():
    AD29 = 0xdd
    Message29=bytearray([b_29])
    Message29.insert(0, AD29)
    port.write(Message29)
    
def Tx30():
    AD30 = 0xde
    Message30=bytearray([b_30])
    Message30.insert(0, AD30)
    port.write(Message30)

def Tx31():
    AD31 = 0xdf
    Message31=bytearray([b_31])
    Message31.insert(0, AD31)
    port.write(Message31)

def Tx32():
    AD32 = 0xe0
    Message32=bytearray([b_32])
    Message32.insert(0, AD32)
    port.write(Message32)

def Tx33():
    AD33 = 0xe1
    Message33=bytearray([b_33])        
    Message33.insert(0, AD33)
    port.write(Message33)

def Tx34():
    AD34 = 0xe2
    Message34=bytearray([b_34])
    Message34.insert(0, AD34)
    port.write(Message34)

def Tx35():
    AD35 = 0xe3
    Message35=bytearray([b_35])
    Message35.insert(0, AD35)
    port.write(Message35)

def Tx36():
    AD36 = 0xe4
    Message36=bytearray([b_36])
    Message36.insert(0, AD36)
    port.write(Message36)

def Tx37():
    AD37 = 0xe5
    Message37=bytearray([b_37])
    Message37.insert(0, AD37)
    port.write(Message37)

def Tx38():
    AD38 = 0xe6
    Message38=bytearray([b_38])
    Message38.insert(0, AD38)
    port.write(Message38)

def Tx39():
    AD39 = 0xe7
    Message39=bytearray([b_39])
    Message39.insert(0, AD39)
    port.write(Message39)    

def Tx40():
    AD40 = 0xe8
    Message40=bytearray([b_40])
    Message40.insert(0, AD40)
    port.write(Message40)

def Tx41():
    AD41 = 0xe9    
    Message41=bytearray([b_41])
    Message41.insert(0, AD41)
    port.write(Message41)

def Tx42():
    AD42 = 0xea    
    Message42=bytearray([b_42])
    Message42.insert(0, AD42)
    port.write(Message42)

def Tx43():
    AD43 = 0xeb    
    Message43=bytearray([b_43])
    Message43.insert(0, AD43)
    port.write(Message43)

def Tx44():
    AD44 = 0xec    
    Message44=bytearray([b_44])
    Message44.insert(0, AD44)
    port.write(Message44)

def Tx45():
    AD45 = 0xed    
    Message45=bytearray([b_45])
    Message45.insert(0, AD45)
    port.write(Message45)

def Tx46():
    AD46 = 0xee     
    Message46=bytearray([b_46])
    Message46.insert(0, AD46)
    port.write(Message46)

def Tx47():
    AD47 = 0xef    
    Message47=bytearray([b_47])
    Message47.insert(0, AD47)
    port.write(Message47)

def Tx48():
    AD48 = 0xf0     
    Message48=bytearray([b_48])
    Message48.insert(0, AD48)
    port.write(Message48)

def Tx49():
    AD49 = 0xf1    
    Message49=bytearray([b_49])
    Message49.insert(0, AD49)
    port.write(Message49)

def Tx50():
    AD50 = 0xf2    
    Message50=bytearray([b_50])
    Message50.insert(0, AD50)
    port.write(Message50)

def Tx51():
    AD51 = 0xf3     
    Message51=bytearray([b_51])
    Message51.insert(0, AD51)
    port.write(Message51)

def Tx52():
    AD52 = 0xf4    
    Message52=bytearray([b_52])
    Message52.insert(0, AD52)
    port.write(Message52)

def Tx53():
    AD53 = 0xf5    
    Message53=bytearray([b_53])
    Message53.insert(0, AD53)
    port.write(Message53)

def Tx54():
    AD54 = 0xf6     
    Message54=bytearray([b_54])
    Message54.insert(0, AD54)
    port.write(Message54)

def Tx55():
    AD55 = 0xf7    
    Message55=bytearray([b_55])
    Message55.insert(0, AD55)
    port.write(Message55)

def Tx56():
    AD56 = 0xf8    
    Message56=bytearray([b_56])
    Message56.insert(0, AD56)
    port.write(Message56)

def Tx57():
    AD57 = 0xf9    
    Message57=bytearray([b_57])
    Message57.insert(0, AD57)
    port.write(Message57)

def Tx58():
    AD58 = 0xfa    
    Message58=bytearray([b_58])
    Message58.insert(0, AD58)
    port.write(Message58)

def Tx59():
    AD59 = 0xfb    
    Message59=bytearray([b_59])
    Message59.insert(0, AD59)
    port.write(Message59)

def Tx60():
    AD60 = 0xfc    
    Message60=bytearray([b_60])
    Message60.insert(0, AD60)
    port.write(Message60)

def Tx61():
    AD61 = 0xfd    
    Message61=bytearray([b_61])
    Message61.insert(0, AD61)
    port.write(Message61)

def Tx62():
    AD62 = 0xfe    
    Message62=bytearray([b_62])
    Message62.insert(0, AD62)
    port.write(Message62)

def Tx63():
    AD63 = 0xff    
    Message63=bytearray([b_63])
    Message63.insert(0, AD63)
    port.write(Message63)


# Call Tx every 2 seconds

def start_timer():
    def keepalive():
        dummy.invoke()
        while True:
            Tx0()
            Tx1()
            Tx2()
            Tx3()
            Tx4()
            Tx5()
            Tx6()
            Tx7()
            Tx8()
            Tx9()
            Tx10()
            Tx11()
            Tx12()
            Tx13()
            Tx14()
            Tx15()
            Tx16()
            Tx17()
            Tx18()
            Tx19()
            Tx20()
            Tx21()
            Tx22()
            Tx23()
            Tx24()
            Tx25()
            Tx26()
            Tx27()
            Tx28()
            Tx29()
            Tx30()
            Tx31()
            Tx32()
            Tx33()
            Tx34()
            Tx35()
            Tx36()
            Tx37()
            Tx38()
            Tx39()
            Tx40()
            Tx41()
            Tx42()
            Tx43()
            Tx44()
            Tx45()
            Tx46()
            Tx47()
            Tx48()
            Tx49()
            Tx50()
            Tx51()
            Tx52()
            Tx53()
            Tx54()
            Tx55()
            Tx56()
            Tx57()
            Tx58()
            Tx59()
            Tx60()
            Tx61()
            Tx62()
            Tx63()
            time.sleep(1.3)
    t = threading.Thread(target=keepalive)
    t.daemon=True
    t.start()

# Call from checkbutton to start sequence

def run0():
    scan0()
    Tx0()

def run1():
    scan1()
    Tx1()

def run2():
    scan2()
    Tx2()

def run3():
    scan3()
    Tx3()

def run4():
    scan4()
    Tx4()

def run5():
    scan5()
    Tx5()

def run6():
    scan6()
    Tx6()

def run7():
    scan7()
    Tx7()

def run8():
    scan8()
    Tx8()

def run9():
    scan9()
    Tx9()

def run10():
    scan10()
    Tx10()

def run11():
    scan11()
    Tx11()

def run12():
    scan12()
    Tx12()

def run13():
    scan13()
    Tx13()

def run14():
    scan14()
    Tx14()

def run15():
    scan15()
    Tx15()

def run16():
    scan16()
    Tx16()

def run17():
    scan17()
    Tx17()

def run18():
    scan18()
    Tx18()

def run19():
    scan19()
    Tx19()

def run20():
    scan20()
    Tx20()

def run21():
    scan21()
    Tx21()

def run22():
    scan22()
    Tx22()

def run23():
    scan23()
    Tx23()

def run24():
    scan24()
    Tx24()

def run25():
    scan25()
    Tx25()

def run26():
    scan26()
    Tx26()

def run27():
    scan27()
    Tx27()

def run28():
    scan28()
    Tx28()

def run29():
    scan29()
    Tx29()

def run30():
    scan30()
    Tx30()

def run31():
    scan31()
    Tx31()

def run32():
    scan32()
    Tx32()

def run33():
    scan33()
    Tx33()

def run34():
    scan34()
    Tx34()

def run35():
    scan35()
    Tx35()

def run36():
    scan36()
    Tx36()

def run37():
    scan37()
    Tx37()

def run38():
    scan38()
    Tx38()

def run39():
    scan39()
    Tx39()

def run40():
    scan40()
    Tx40()

def run41():
    scan41()
    Tx41()

def run42():
    scan42()
    Tx42()

def run43():
    scan43()
    Tx43()

def run44():
    scan44()
    Tx44()

def run45():
    scan45()
    Tx45()

def run46():
    scan46()
    Tx46()

def run47():
    scan47()
    Tx47()

def run48():
    scan48()
    Tx48()
    
def run49():
    scan49()
    Tx49()

def run50():
    scan50()
    Tx50()

def run51():
    scan51()
    Tx51()

def run52():
    scan52()
    Tx52()

def run53():
    scan53()
    Tx53()

def run54():
    scan54()
    Tx54()

def run55():
    scan55()
    Tx50()

def run56():
    scan56()
    Tx56()

def run57():
    scan57()
    Tx57()

def run58():
    scan58()
    Tx58()

def run59():
    scan59()
    Tx59()

def run60():
    scan60()
    Tx60()

def run61():
    scan61()
    Tx61()

def run62():
    scan62()
    Tx62()

def run63():
    scan63()
    Tx63()

# Initialise scan

def first():
    scan0()
    scan1()
    scan2()
    scan3()
    scan4()
    scan5()
    scan6()
    scan7()
    scan8()
    scan9()
    scan10()
    scan11()
    scan12()
    scan13()
    scan14()
    scan15()
    scan16()
    scan17()
    scan18()
    scan19()
    scan20()
    scan21()
    scan22()
    scan23()
    scan24()
    scan25()
    scan26()
    scan27()
    scan28()
    scan29()
    scan30()
    scan31()
    scan32()
    scan33()
    scan34()
    scan35()
    scan36()
    scan37()
    scan38()
    scan39()
    scan40()
    scan41()
    scan42()
    scan43()
    scan44()
    scan45()
    scan46()
    scan47()
    scan48()
    scan49()
    scan50()
    scan51()
    scan52()
    scan53()
    scan54()
    scan55()
    scan56()
    scan57()
    scan58()
    scan59()
    scan60()
    scan61()
    scan62()
    scan63()    
    Tx0()
    Tx1()
    Tx2()
    Tx3()
    Tx4()
    Tx5()
    Tx6()
    Tx7()
    Tx8()
    Tx9()
    Tx10()
    Tx11()
    Tx12()
    Tx13()
    Tx14()
    Tx15()
    Tx16()
    Tx17()
    Tx18()
    Tx19()
    Tx20()
    Tx21()
    Tx22()
    Tx23()
    Tx24()
    Tx25()
    Tx26()
    Tx27()
    Tx28()
    Tx29()
    Tx30()
    Tx31()
    Tx32()
    Tx33()
    Tx34()
    Tx35()
    Tx36()
    Tx37()
    Tx38()
    Tx39()
    Tx40()
    Tx41()
    Tx42()
    Tx43()
    Tx44()
    Tx45()
    Tx46()
    Tx47()
    Tx48()
    Tx49()
    Tx50()
    Tx51()
    Tx52()
    Tx53()
    Tx54()
    Tx55()
    Tx56()
    Tx57()
    Tx58()
    Tx59()
    Tx60()
    Tx61()
    Tx62()
    Tx63()


# All buttons Off

def blocka():
    if b0_0var.get()>0:
        b0_0.invoke()
    if b0_1var.get()>0:
        b0_1.invoke()
    if b0_2var.get()>0:
        b0_2.invoke()
    if b0_3var.get()>0:
        b0_3.invoke()
    if b0_4var.get()>0:
        b0_4.invoke()
    if b0_5var.get()>0:
        b0_5.invoke()
    if b0_6var.get()>0:
        b0_6.invoke()

    if b1_0var.get()>0:
        b1_0.invoke()
    if b1_1var.get()>0:
        b1_1.invoke()
    if b1_2var.get()>0:
        b1_2.invoke()
    if b1_3var.get()>0:
        b1_3.invoke()
    if b1_4var.get()>0:
        b1_4.invoke()
    if b1_5var.get()>0:
        b1_5.invoke()
    if b1_6var.get()>0:
        b1_6.invoke()

    if b2_0var.get()>0:
        b2_0.invoke()
    if b2_1var.get()>0:
        b2_1.invoke()
    if b2_2var.get()>0:
        b2_2.invoke()
    if b2_3var.get()>0:
        b2_3.invoke()
    if b2_4var.get()>0:
        b2_4.invoke()
    if b2_5var.get()>0:
        b2_5.invoke()
    if b2_6var.get()>0:
        b2_6.invoke()

    if b3_0var.get()>0:
        b3_0.invoke()
    if b3_1var.get()>0:
        b3_1.invoke()
    if b3_2var.get()>0:
        b3_2.invoke()
    if b3_3var.get()>0:
        b3_3.invoke()
    if b3_4var.get()>0:
        b3_4.invoke()
    if b3_5var.get()>0:
        b3_5.invoke()
    if b3_6var.get()>0:
        b3_6.invoke()

    if b4_0var.get()>0:
        b4_0.invoke()
    if b4_1var.get()>0:
        b4_1.invoke()
    if b4_2var.get()>0:
        b4_2.invoke()
    if b4_3var.get()>0:
        b4_3.invoke()
    if b4_4var.get()>0:
        b4_4.invoke()
    if b4_5var.get()>0:
        b4_5.invoke()
    if b4_6var.get()>0:
        b4_6.invoke()

    if b5_0var.get()>0:
        b5_0.invoke()
    if b5_1var.get()>0:
        b5_1.invoke()
    if b5_2var.get()>0:
        b5_2.invoke()
    if b5_3var.get()>0:
        b5_3.invoke()
    if b5_4var.get()>0:
        b5_4.invoke()
    if b5_5var.get()>0:
        b5_5.invoke()
    if b5_6var.get()>0:
        b5_6.invoke()

    if b6_0var.get()>0:
        b6_0.invoke()
    if b6_1var.get()>0:
        b6_1.invoke()
    if b6_2var.get()>0:
        b6_2.invoke()
    if b6_3var.get()>0:
        b6_3.invoke()
    if b6_4var.get()>0:
        b6_4.invoke()
    if b6_5var.get()>0:
        b6_5.invoke()
    if b6_6var.get()>0:
        b6_6.invoke()

    if b7_0var.get()>0:
        b7_0.invoke()
    if b7_1var.get()>0:
        b7_1.invoke()
    if b7_2var.get()>0:
        b7_2.invoke()
    if b7_3var.get()>0:
        b7_3.invoke()
    if b7_4var.get()>0:
        b7_4.invoke()
    if b7_5var.get()>0:
        b7_5.invoke()
    if b7_6var.get()>0:
        b7_6.invoke()

def blockb():
    if b8_0var.get()>0:
        b8_0.invoke()
    if b8_1var.get()>0:
        b8_1.invoke()
    if b8_2var.get()>0:
        b8_2.invoke()
    if b8_3var.get()>0:
        b8_3.invoke()
    if b8_4var.get()>0:
        b8_4.invoke()
    if b8_5var.get()>0:
        b8_5.invoke()
    if b8_6var.get()>0:
        b8_6.invoke()

    if b9_0var.get()>0:
        b9_0.invoke()
    if b9_1var.get()>0:
        b9_1.invoke()
    if b9_2var.get()>0:
        b9_2.invoke()
    if b9_3var.get()>0:
        b9_3.invoke()
    if b9_4var.get()>0:
        b9_4.invoke()
    if b9_5var.get()>0:
        b9_5.invoke()
    if b9_6var.get()>0:
        b9_6.invoke()

    if b10_0var.get()>0:
        b10_0.invoke()
    if b10_1var.get()>0:
        b10_1.invoke()
    if b10_2var.get()>0:
        b10_2.invoke()
    if b10_3var.get()>0:
        b10_3.invoke()
    if b10_4var.get()>0:
        b10_4.invoke()
    if b10_5var.get()>0:
        b10_5.invoke()
    if b10_6var.get()>0:
        b10_6.invoke()

    if b11_0var.get()>0:
        b11_0.invoke()
    if b11_1var.get()>0:
        b11_1.invoke()
    if b11_2var.get()>0:
        b11_2.invoke()
    if b11_3var.get()>0:
        b11_3.invoke()
    if b11_4var.get()>0:
        b11_4.invoke()
    if b11_5var.get()>0:
        b11_5.invoke()
    if b11_6var.get()>0:
        b11_6.invoke()

    if b12_0var.get()>0:
        b12_0.invoke()
    if b12_1var.get()>0:
        b12_1.invoke()
    if b12_2var.get()>0:
        b12_2.invoke()
    if b12_3var.get()>0:
        b12_3.invoke()
    if b12_4var.get()>0:
        b12_4.invoke()
    if b12_5var.get()>0:
        b12_5.invoke()
    if b12_6var.get()>0:
        b12_6.invoke()

    if b13_0var.get()>0:
        b13_0.invoke()
    if b13_1var.get()>0:
        b13_1.invoke()
    if b13_2var.get()>0:
        b13_2.invoke()
    if b13_3var.get()>0:
        b13_3.invoke()
    if b13_4var.get()>0:
        b13_4.invoke()
    if b13_5var.get()>0:
        b13_5.invoke()
    if b13_6var.get()>0:
        b13_6.invoke()

    if b14_0var.get()>0:
        b14_0.invoke()
    if b14_1var.get()>0:
        b14_1.invoke()
    if b14_2var.get()>0:
        b14_2.invoke()
    if b14_3var.get()>0:
        b14_3.invoke()
    if b14_4var.get()>0:
        b14_4.invoke()
    if b14_5var.get()>0:
        b14_5.invoke()
    if b14_6var.get()>0:
        b14_6.invoke()

    if b15_0var.get()>0:
        b15_0.invoke()
    if b15_1var.get()>0:
        b15_1.invoke()
    if b15_2var.get()>0:
        b15_2.invoke()
    if b15_3var.get()>0:
        b15_3.invoke()
    if b15_4var.get()>0:
        b15_4.invoke()
    if b15_5var.get()>0:
        b15_5.invoke()
    if b15_6var.get()>0:
        b15_6.invoke()

def blockc():        
    if b16_0var.get()>0:
        b16_0.invoke()
    if b16_1var.get()>0:
        b16_1.invoke()
    if b16_2var.get()>0:
        b16_2.invoke()
    if b16_3var.get()>0:
        b16_3.invoke()
    if b16_4var.get()>0:
        b16_4.invoke()
    if b16_5var.get()>0:
        b16_5.invoke()
    if b16_6var.get()>0:
        b16_6.invoke()

    if b17_0var.get()>0:
        b17_0.invoke()
    if b17_1var.get()>0:
        b17_1.invoke()
    if b17_2var.get()>0:
        b17_2.invoke()
    if b17_3var.get()>0:
        b17_3.invoke()
    if b17_4var.get()>0:
        b17_4.invoke()
    if b17_5var.get()>0:
        b17_5.invoke()
    if b17_6var.get()>0:
        b17_6.invoke()

    if b18_0var.get()>0:
        b18_0.invoke()
    if b18_1var.get()>0:
        b18_1.invoke()
    if b18_2var.get()>0:
        b18_2.invoke()
    if b18_3var.get()>0:
        b18_3.invoke()
    if b18_4var.get()>0:
        b18_4.invoke()
    if b18_5var.get()>0:
        b18_5.invoke()
    if b18_6var.get()>0:
        b18_6.invoke()

    if b19_0var.get()>0:
        b19_0.invoke()
    if b19_1var.get()>0:
        b19_1.invoke()
    if b19_2var.get()>0:
        b19_2.invoke()
    if b19_3var.get()>0:
        b19_3.invoke()
    if b19_4var.get()>0:
        b19_4.invoke()
    if b19_5var.get()>0:
        b19_5.invoke()
    if b19_6var.get()>0:
        b19_6.invoke()

    if b20_0var.get()>0:
        b20_0.invoke()
    if b20_1var.get()>0:
        b20_1.invoke()
    if b20_2var.get()>0:
        b20_2.invoke()
    if b20_3var.get()>0:
        b20_3.invoke()
    if b20_4var.get()>0:
        b20_4.invoke()
    if b20_5var.get()>0:
        b20_5.invoke()
    if b20_6var.get()>0:
        b20_6.invoke()

    if b21_0var.get()>0:
        b21_0.invoke()
    if b21_1var.get()>0:
        b21_1.invoke()
    if b21_2var.get()>0:
        b21_2.invoke()
    if b21_3var.get()>0:
        b21_3.invoke()
    if b21_4var.get()>0:
        b21_4.invoke()
    if b21_5var.get()>0:
        b21_5.invoke()
    if b21_6var.get()>0:
        b21_6.invoke()

    if b22_0var.get()>0:
        b22_0.invoke()
    if b22_1var.get()>0:
        b22_1.invoke()
    if b22_2var.get()>0:
        b22_2.invoke()
    if b22_3var.get()>0:
        b22_3.invoke()
    if b22_4var.get()>0:
        b22_4.invoke()
    if b22_5var.get()>0:
        b22_5.invoke()
    if b22_6var.get()>0:
        b22_6.invoke()

    if b23_0var.get()>0:
        b23_0.invoke()
    if b23_1var.get()>0:
        b23_1.invoke()
    if b23_2var.get()>0:
        b23_2.invoke()
    if b23_3var.get()>0:
        b23_3.invoke()
    if b23_4var.get()>0:
        b23_4.invoke()
    if b23_5var.get()>0:
        b23_5.invoke()
    if b23_6var.get()>0:
        b23_6.invoke()

def blockd():
    if b24_0var.get()>0:
        b24_0.invoke()
    if b24_1var.get()>0:
        b24_1.invoke()
    if b24_2var.get()>0:
        b24_2.invoke()
    if b24_3var.get()>0:
        b24_3.invoke()
    if b24_4var.get()>0:
        b24_4.invoke()
    if b24_5var.get()>0:
        b24_5.invoke()
    if b24_6var.get()>0:
        b24_6.invoke()

    if b25_0var.get()>0:
        b25_0.invoke()
    if b25_1var.get()>0:
        b25_1.invoke()
    if b25_2var.get()>0:
        b25_2.invoke()
    if b25_3var.get()>0:
        b25_3.invoke()
    if b25_4var.get()>0:
        b25_4.invoke()
    if b25_5var.get()>0:
        b25_5.invoke()
    if b25_6var.get()>0:
        b25_6.invoke()

    if b26_0var.get()>0:
        b26_0.invoke()
    if b26_1var.get()>0:
        b26_1.invoke()
    if b26_2var.get()>0:
        b26_2.invoke()
    if b26_3var.get()>0:
        b26_3.invoke()
    if b26_4var.get()>0:
        b26_4.invoke()
    if b26_5var.get()>0:
        b26_5.invoke()
    if b26_6var.get()>0:
        b26_6.invoke()

    if b27_0var.get()>0:
        b27_0.invoke()
    if b27_1var.get()>0:
        b27_1.invoke()
    if b27_2var.get()>0:
        b27_2.invoke()
    if b27_3var.get()>0:
        b27_3.invoke()
    if b27_4var.get()>0:
        b27_4.invoke()
    if b27_5var.get()>0:
        b27_5.invoke()
    if b27_6var.get()>0:
        b27_6.invoke()

    if b28_0var.get()>0:
        b28_0.invoke()
    if b28_1var.get()>0:
        b28_1.invoke()
    if b28_2var.get()>0:
        b28_2.invoke()
    if b28_3var.get()>0:
        b28_3.invoke()
    if b28_4var.get()>0:
        b28_4.invoke()
    if b28_5var.get()>0:
        b28_5.invoke()
    if b28_6var.get()>0:
        b28_6.invoke()

    if b29_0var.get()>0:
        b29_0.invoke()
    if b29_1var.get()>0:
        b29_1.invoke()
    if b29_2var.get()>0:
        b29_2.invoke()
    if b29_3var.get()>0:
        b29_3.invoke()
    if b29_4var.get()>0:
        b29_4.invoke()
    if b29_5var.get()>0:
        b29_5.invoke()
    if b29_6var.get()>0:
        b29_6.invoke()

    if b30_0var.get()>0:
        b30_0.invoke()
    if b30_1var.get()>0:
        b30_1.invoke()
    if b30_2var.get()>0:
        b30_2.invoke()
    if b30_3var.get()>0:
        b30_3.invoke()
    if b30_4var.get()>0:
        b30_4.invoke()
    if b30_5var.get()>0:
        b30_5.invoke()
    if b30_6var.get()>0:
        b30_6.invoke()

    if b31_0var.get()>0:
        b31_0.invoke()
    if b31_1var.get()>0:
        b31_1.invoke()
    if b31_2var.get()>0:
        b31_2.invoke()
    if b31_3var.get()>0:
        b31_3.invoke()
    if b31_4var.get()>0:
        b31_4.invoke()
    if b31_5var.get()>0:
        b31_5.invoke()
    if b31_6var.get()>0:
        b31_6.invoke()

def blocke():
    if b32_0var.get()>0:
        b32_0.invoke()
    if b32_1var.get()>0:
        b32_1.invoke()
    if b32_2var.get()>0:
        b32_2.invoke()
    if b32_3var.get()>0:
        b32_3.invoke()
    if b32_4var.get()>0:
        b32_4.invoke()
    if b32_5var.get()>0:
        b32_5.invoke()
    if b32_6var.get()>0:
        b32_6.invoke()

    if b33_0var.get()>0:
        b33_0.invoke()
    if b33_1var.get()>0:
        b33_1.invoke()
    if b33_2var.get()>0:
        b33_2.invoke()
    if b33_3var.get()>0:
        b33_3.invoke()
    if b33_4var.get()>0:
        b33_4.invoke()
    if b33_5var.get()>0:
        b33_5.invoke()
    if b33_6var.get()>0:
        b33_6.invoke()

    if b34_0var.get()>0:
        b34_0.invoke()
    if b34_1var.get()>0:
        b34_1.invoke()
    if b34_2var.get()>0:
        b34_2.invoke()
    if b34_3var.get()>0:
        b34_3.invoke()
    if b34_4var.get()>0:
        b34_4.invoke()
    if b34_5var.get()>0:
        b34_5.invoke()
    if b34_6var.get()>0:
        b34_6.invoke()

    if b35_0var.get()>0:
        b35_0.invoke()
    if b35_1var.get()>0:
        b35_1.invoke()
    if b35_2var.get()>0:
        b35_2.invoke()
    if b35_3var.get()>0:
        b35_3.invoke()
    if b35_4var.get()>0:
        b35_4.invoke()
    if b35_5var.get()>0:
        b35_5.invoke()
    if b35_6var.get()>0:
        b35_6.invoke()

    if b36_0var.get()>0:
        b36_0.invoke()
    if b36_1var.get()>0:
        b36_1.invoke()
    if b36_2var.get()>0:
        b36_2.invoke()
    if b36_3var.get()>0:
        b36_3.invoke()
    if b36_4var.get()>0:
        b36_4.invoke()
    if b36_5var.get()>0:
        b36_5.invoke()
    if b36_6var.get()>0:
        b36_6.invoke()

    if b37_0var.get()>0:
        b37_0.invoke()
    if b37_1var.get()>0:
        b37_1.invoke()
    if b37_2var.get()>0:
        b37_2.invoke()
    if b37_3var.get()>0:
        b37_3.invoke()
    if b37_4var.get()>0:
        b37_4.invoke()
    if b37_5var.get()>0:
        b37_5.invoke()
    if b37_6var.get()>0:
        b37_6.invoke()

    if b38_0var.get()>0:
        b38_0.invoke()
    if b38_1var.get()>0:
        b38_1.invoke()
    if b38_2var.get()>0:
        b38_2.invoke()
    if b38_3var.get()>0:
        b38_3.invoke()
    if b38_4var.get()>0:
        b38_4.invoke()
    if b38_5var.get()>0:
        b38_5.invoke()
    if b38_6var.get()>0:
        b38_6.invoke()

    if b39_0var.get()>0:
        b39_0.invoke()
    if b39_1var.get()>0:
        b39_1.invoke()
    if b39_2var.get()>0:
        b39_2.invoke()
    if b39_3var.get()>0:
        b39_3.invoke()
    if b39_4var.get()>0:
        b39_4.invoke()
    if b39_5var.get()>0:
        b39_5.invoke()
    if b39_6var.get()>0:
        b39_6.invoke()

def blockf():
    if b40_0var.get()>0:
        b40_0.invoke()
    if b40_1var.get()>0:
        b40_1.invoke()
    if b40_2var.get()>0:
        b40_2.invoke()
    if b40_3var.get()>0:
        b40_3.invoke()
    if b40_4var.get()>0:
        b40_4.invoke()
    if b40_5var.get()>0:
        b40_5.invoke()
    if b40_6var.get()>0:
        b40_6.invoke()

    if b41_0var.get()>0:
        b41_0.invoke()
    if b41_1var.get()>0:
        b41_1.invoke()
    if b41_2var.get()>0:
        b41_2.invoke()
    if b41_3var.get()>0:
        b41_3.invoke()
    if b41_4var.get()>0:
        b41_4.invoke()
    if b41_5var.get()>0:
        b41_5.invoke()
    if b41_6var.get()>0:
        b41_6.invoke()

    if b42_0var.get()>0:
        b42_0.invoke()
    if b42_1var.get()>0:
        b42_1.invoke()
    if b42_2var.get()>0:
        b42_2.invoke()
    if b42_3var.get()>0:
        b42_3.invoke()
    if b42_4var.get()>0:
        b42_4.invoke()
    if b42_5var.get()>0:
        b42_5.invoke()
    if b42_6var.get()>0:
        b42_6.invoke()

    if b43_0var.get()>0:
        b43_0.invoke()
    if b43_1var.get()>0:
        b43_1.invoke()
    if b43_2var.get()>0:
        b43_2.invoke()
    if b43_3var.get()>0:
        b43_3.invoke()
    if b43_4var.get()>0:
        b43_4.invoke()
    if b43_5var.get()>0:
        b43_5.invoke()
    if b43_6var.get()>0:
        b43_6.invoke()

    if b44_0var.get()>0:
        b44_0.invoke()
    if b44_1var.get()>0:
        b44_1.invoke()
    if b44_2var.get()>0:
        b44_2.invoke()
    if b44_3var.get()>0:
        b44_3.invoke()
    if b44_4var.get()>0:
        b44_4.invoke()
    if b44_5var.get()>0:
        b44_5.invoke()
    if b44_6var.get()>0:
        b44_6.invoke()

    if b45_0var.get()>0:
        b45_0.invoke()
    if b45_1var.get()>0:
        b45_1.invoke()
    if b45_2var.get()>0:
        b45_2.invoke()
    if b45_3var.get()>0:
        b45_3.invoke()
    if b45_4var.get()>0:
        b45_4.invoke()
    if b45_5var.get()>0:
        b45_5.invoke()
    if b45_6var.get()>0:
        b45_6.invoke()

    if b46_0var.get()>0:
        b46_0.invoke()
    if b46_1var.get()>0:
        b46_1.invoke()
    if b46_2var.get()>0:
        b46_2.invoke()
    if b46_3var.get()>0:
        b46_3.invoke()
    if b46_4var.get()>0:
        b46_4.invoke()
    if b46_5var.get()>0:
        b46_5.invoke()
    if b46_6var.get()>0:
        b46_6.invoke()

    if b47_0var.get()>0:
        b47_0.invoke()
    if b47_1var.get()>0:
        b47_1.invoke()
    if b47_2var.get()>0:
        b47_2.invoke()
    if b47_3var.get()>0:
        b47_3.invoke()
    if b47_4var.get()>0:
        b47_4.invoke()
    if b47_5var.get()>0:
        b47_5.invoke()
    if b47_6var.get()>0:
        b47_6.invoke()

def blockg():
    if b48_0var.get()>0:
        b48_0.invoke()
    if b48_1var.get()>0:
        b48_1.invoke()
    if b48_2var.get()>0:
        b48_2.invoke()
    if b48_3var.get()>0:
        b48_3.invoke()
    if b48_4var.get()>0:
        b48_4.invoke()
    if b48_5var.get()>0:
        b48_5.invoke()
    if b48_6var.get()>0:
        b48_6.invoke()

    if b49_0var.get()>0:
        b49_0.invoke()
    if b49_1var.get()>0:
        b49_1.invoke()
    if b49_2var.get()>0:
        b49_2.invoke()
    if b49_3var.get()>0:
        b49_3.invoke()
    if b49_4var.get()>0:
        b49_4.invoke()
    if b49_5var.get()>0:
        b49_5.invoke()
    if b49_6var.get()>0:
        b49_6.invoke()

    if b50_0var.get()>0:
        b50_0.invoke()
    if b50_1var.get()>0:
        b50_1.invoke()
    if b50_2var.get()>0:
        b50_2.invoke()
    if b50_3var.get()>0:
        b50_3.invoke()
    if b50_4var.get()>0:
        b50_4.invoke()
    if b50_5var.get()>0:
        b50_5.invoke()
    if b50_6var.get()>0:
        b50_6.invoke()

    if b51_0var.get()>0:
        b51_0.invoke()
    if b51_1var.get()>0:
        b51_1.invoke()
    if b51_2var.get()>0:
        b51_2.invoke()
    if b51_3var.get()>0:
        b51_3.invoke()
    if b51_4var.get()>0:
        b51_4.invoke()
    if b51_5var.get()>0:
        b51_5.invoke()
    if b51_6var.get()>0:
        b51_6.invoke()

    if b52_0var.get()>0:
        b52_0.invoke()
    if b52_1var.get()>0:
        b52_1.invoke()
    if b52_2var.get()>0:
        b52_2.invoke()
    if b52_3var.get()>0:
        b52_3.invoke()
    if b52_4var.get()>0:
        b52_4.invoke()
    if b52_5var.get()>0:
        b52_5.invoke()
    if b52_6var.get()>0:
        b52_6.invoke()

    if b53_0var.get()>0:
        b53_0.invoke()
    if b53_1var.get()>0:
        b53_1.invoke()
    if b53_2var.get()>0:
        b53_2.invoke()
    if b53_3var.get()>0:
        b53_3.invoke()
    if b53_4var.get()>0:
        b53_4.invoke()
    if b53_5var.get()>0:
        b53_5.invoke()
    if b53_6var.get()>0:
        b53_6.invoke()

    if b54_0var.get()>0:
        b54_0.invoke()
    if b54_1var.get()>0:
        b54_1.invoke()
    if b54_2var.get()>0:
        b54_2.invoke()
    if b54_3var.get()>0:
        b54_3.invoke()
    if b54_4var.get()>0:
        b54_4.invoke()
    if b54_5var.get()>0:
        b54_5.invoke()
    if b54_6var.get()>0:
        b54_6.invoke()

    if b55_0var.get()>0:
        b55_0.invoke()
    if b55_1var.get()>0:
        b55_1.invoke()
    if b55_2var.get()>0:
        b55_2.invoke()
    if b55_3var.get()>0:
        b55_3.invoke()
    if b55_4var.get()>0:
        b55_4.invoke()
    if b55_5var.get()>0:
        b55_5.invoke()
    if b55_6var.get()>0:
        b55_6.invoke()

def blockh():
    if b56_0var.get()>0:
        b56_0.invoke()
    if b56_1var.get()>0:
        b56_1.invoke()
    if b56_2var.get()>0:
        b56_2.invoke()
    if b56_3var.get()>0:
        b56_3.invoke()
    if b56_4var.get()>0:
        b56_4.invoke()
    if b56_5var.get()>0:
        b56_5.invoke()
    if b56_6var.get()>0:
        b56_6.invoke()

    if b57_0var.get()>0:
        b57_0.invoke()
    if b57_1var.get()>0:
        b57_1.invoke()
    if b57_2var.get()>0:
        b57_2.invoke()
    if b57_3var.get()>0:
        b57_3.invoke()
    if b57_4var.get()>0:
        b57_4.invoke()
    if b57_5var.get()>0:
        b57_5.invoke()
    if b57_6var.get()>0:
        b57_6.invoke()

    if b58_0var.get()>0:
        b58_0.invoke()
    if b58_1var.get()>0:
        b58_1.invoke()
    if b58_2var.get()>0:
        b58_2.invoke()
    if b58_3var.get()>0:
        b58_3.invoke()
    if b58_4var.get()>0:
        b58_4.invoke()
    if b58_5var.get()>0:
        b58_5.invoke()
    if b58_6var.get()>0:
        b58_6.invoke()

    if b59_0var.get()>0:
        b59_0.invoke()
    if b59_1var.get()>0:
        b59_1.invoke()
    if b59_2var.get()>0:
        b59_2.invoke()
    if b59_3var.get()>0:
        b59_3.invoke()
    if b59_4var.get()>0:
        b59_4.invoke()
    if b59_5var.get()>0:
        b59_5.invoke()
    if b59_6var.get()>0:
        b59_6.invoke()

    if b60_0var.get()>0:
        b60_0.invoke()
    if b60_1var.get()>0:
        b60_1.invoke()
    if b60_2var.get()>0:
        b60_2.invoke()
    if b60_3var.get()>0:
        b60_3.invoke()
    if b60_4var.get()>0:
        b60_4.invoke()
    if b60_5var.get()>0:
        b60_5.invoke()
    if b60_6var.get()>0:
        b60_6.invoke()

    if b61_0var.get()>0:
        b61_0.invoke()
    if b61_1var.get()>0:
        b61_1.invoke()
    if b61_2var.get()>0:
        b61_2.invoke()
    if b61_3var.get()>0:
        b61_3.invoke()
    if b61_4var.get()>0:
        b61_4.invoke()
    if b61_5var.get()>0:
        b61_5.invoke()
    if b61_6var.get()>0:
        b61_6.invoke()

    if b62_0var.get()>0:
        b62_0.invoke()
    if b62_1var.get()>0:
        b62_1.invoke()
    if b62_2var.get()>0:
        b62_2.invoke()
    if b62_3var.get()>0:
        b62_3.invoke()
    if b62_4var.get()>0:
        b62_4.invoke()
    if b62_5var.get()>0:
        b62_5.invoke()
    if b62_6var.get()>0:
        b62_6.invoke()

    if b63_0var.get()>0:
        b63_0.invoke()
    if b63_1var.get()>0:
        b63_1.invoke()
    if b63_2var.get()>0:
        b63_2.invoke()
    if b63_3var.get()>0:
        b63_3.invoke()
    if b63_4var.get()>0:
        b63_4.invoke()
    if b63_5var.get()>0:
        b63_5.invoke()
    if b63_6var.get()>0:
        b63_6.invoke()

def alloff():
    blocka.invoke()
    blockb.invoke()
    blockc.invoke()
    blockd.invoke()
    blocke.invoke()
    blockf.invoke()
    blockg.invoke()
    blockh.invoke()

root = Tk()

content = ttk.Frame(root, padding=(24,3,12,12))

# Row 1 Draw

# defining labels
nameb0_0 = ttk.Label(content, text="Byte 0")
nameb1_0 = ttk.Label(content, text="Byte 1")
nameb2_0 = ttk.Label(content, text="Byte 2")
nameb3_0 = ttk.Label(content, text="Byte 3")

# Defining number type
b0_0var = IntVar()
b0_1var = IntVar()
b0_2var = IntVar()
b0_3var = IntVar()
b0_4var = IntVar()
b0_5var = IntVar()
b0_6var = IntVar()
b0_7var = IntVar()

b1_0var = IntVar()
b1_1var = IntVar()
b1_2var = IntVar()
b1_3var = IntVar()
b1_4var = IntVar()
b1_5var = IntVar()
b1_6var = IntVar()
b1_7var = IntVar()

b2_0var = IntVar()
b2_1var = IntVar()
b2_2var = IntVar()
b2_3var = IntVar()
b2_4var = IntVar()
b2_5var = IntVar()
b2_6var = IntVar()
b2_7var = IntVar()

b3_0var = IntVar()
b3_1var = IntVar()
b3_2var = IntVar()
b3_3var = IntVar()
b3_4var = IntVar()
b3_5var = IntVar()
b3_6var = IntVar()
b3_7var = IntVar()

# setting default button position
b0_0var.set(0)
b0_1var.set(0)
b0_2var.set(0)
b0_3var.set(0)
b0_4var.set(0)
b0_5var.set(0)
b0_6var.set(0)
b0_7var.set(0)

b1_0var.set(0)
b1_1var.set(0)
b1_2var.set(0)
b1_3var.set(0)
b1_4var.set(0)
b1_5var.set(0)
b1_6var.set(0)
b1_7var.set(0)

b2_0var.set(0)
b2_1var.set(0)
b2_2var.set(0)
b2_3var.set(0)
b2_4var.set(0)
b2_5var.set(0)
b2_6var.set(0)
b2_7var.set(0)

b3_0var.set(0)
b3_1var.set(0)
b3_2var.set(0)
b3_3var.set(0)
b3_4var.set(0)
b3_5var.set(0)
b3_6var.set(0)
b3_7var.set(0)

# defining button
b0_0 = ttk.Checkbutton(content, command=run0, text="0", variable=b0_0var, onvalue=0x01, offvalue=0x00)
b0_1 = ttk.Checkbutton(content, command=run0, text="1", variable=b0_1var, onvalue=0x02, offvalue=0x00)
b0_2 = ttk.Checkbutton(content, command=run0, text="2", variable=b0_2var, onvalue=0x04, offvalue=0x00)
b0_3 = ttk.Checkbutton(content, command=run0, text="3", variable=b0_3var, onvalue=0x08, offvalue=0x00)
b0_4 = ttk.Checkbutton(content, command=run0, text="4", variable=b0_4var, onvalue=0x10, offvalue=0x00)
b0_5 = ttk.Checkbutton(content, command=run0, text="5", variable=b0_5var, onvalue=0x20, offvalue=0x00)
b0_6 = ttk.Checkbutton(content, command=run0, text="6", variable=b0_6var, onvalue=0x40, offvalue=0x00)
b0_7 = ttk.Checkbutton(content, command=run0, text="7", variable=b0_7var, onvalue=0x00, offvalue=0x00)

b1_0 = ttk.Checkbutton(content, command=run1, text="0", variable=b1_0var, onvalue=0x01, offvalue=0x00)
b1_1 = ttk.Checkbutton(content, command=run1, text="1", variable=b1_1var, onvalue=0x02, offvalue=0x00)
b1_2 = ttk.Checkbutton(content, command=run1, text="2", variable=b1_2var, onvalue=0x04, offvalue=0x00)
b1_3 = ttk.Checkbutton(content, command=run1, text="3", variable=b1_3var, onvalue=0x08, offvalue=0x00)
b1_4 = ttk.Checkbutton(content, command=run1, text="4", variable=b1_4var, onvalue=0x10, offvalue=0x00)
b1_5 = ttk.Checkbutton(content, command=run1, text="5", variable=b1_5var, onvalue=0x20, offvalue=0x00)
b1_6 = ttk.Checkbutton(content, command=run1, text="6", variable=b1_6var, onvalue=0x40, offvalue=0x00)
b1_7 = ttk.Checkbutton(content, command=run1, text="7", variable=b1_7var, onvalue=0x00, offvalue=0x00)

b2_0 = ttk.Checkbutton(content, command=run2, text="0", variable=b2_0var, onvalue=0x01, offvalue=0x00)
b2_1 = ttk.Checkbutton(content, command=run2, text="1", variable=b2_1var, onvalue=0x02, offvalue=0x00)
b2_2 = ttk.Checkbutton(content, command=run2, text="2", variable=b2_2var, onvalue=0x04, offvalue=0x00)
b2_3 = ttk.Checkbutton(content, command=run2, text="3", variable=b2_3var, onvalue=0x08, offvalue=0x00)
b2_4 = ttk.Checkbutton(content, command=run2, text="4", variable=b2_4var, onvalue=0x10, offvalue=0x00)
b2_5 = ttk.Checkbutton(content, command=run2, text="5", variable=b2_5var, onvalue=0x20, offvalue=0x00)
b2_6 = ttk.Checkbutton(content, command=run2, text="6", variable=b2_6var, onvalue=0x40, offvalue=0x00)
b2_7 = ttk.Checkbutton(content, command=run2, text="7", variable=b2_7var, onvalue=0x00, offvalue=0x00)

b3_0 = ttk.Checkbutton(content, command=run3, text="0", variable=b3_0var, onvalue=0x01, offvalue=0x00)
b3_1 = ttk.Checkbutton(content, command=run3, text="1", variable=b3_1var, onvalue=0x02, offvalue=0x00)
b3_2 = ttk.Checkbutton(content, command=run3, text="2", variable=b3_2var, onvalue=0x04, offvalue=0x00)
b3_3 = ttk.Checkbutton(content, command=run3, text="3", variable=b3_3var, onvalue=0x08, offvalue=0x00)
b3_4 = ttk.Checkbutton(content, command=run3, text="4", variable=b3_4var, onvalue=0x10, offvalue=0x00)
b3_5 = ttk.Checkbutton(content, command=run3, text="5", variable=b3_5var, onvalue=0x20, offvalue=0x00)
b3_6 = ttk.Checkbutton(content, command=run3, text="6", variable=b3_6var, onvalue=0x40, offvalue=0x00)
b3_7 = ttk.Checkbutton(content, command=run3, text="7", variable=b3_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# placing text above each byte
nameb0_0.grid(column=4, row=0, columnspan=2)
nameb1_0.grid(column=12, row=0, columnspan=2)
nameb2_0.grid(column=20, row=0, columnspan=2)
nameb3_0.grid(column=28, row=0, columnspan=2)

# placing buttons on grid
b0_0.grid(column=8,row=3, ipadx=10)
b0_1.grid(column=7,row=3)
b0_2.grid(column=6,row=3)
b0_3.grid(column=5,row=3)
b0_4.grid(column=4,row=3)
b0_5.grid(column=3,row=3)
b0_6.grid(column=2,row=3)

b1_0.grid(column=16,row=3, ipadx=10)
b1_1.grid(column=15,row=3)
b1_2.grid(column=14,row=3)
b1_3.grid(column=13,row=3)
b1_4.grid(column=12,row=3)
b1_5.grid(column=11,row=3)
b1_6.grid(column=10,row=3)

b2_0.grid(column=24,row=3, ipadx=10)
b2_1.grid(column=23,row=3)
b2_2.grid(column=22,row=3)
b2_3.grid(column=21,row=3)
b2_4.grid(column=20,row=3)
b2_5.grid(column=19,row=3)
b2_6.grid(column=18,row=3)

b3_0.grid(column=32,row=3)
b3_1.grid(column=31,row=3)
b3_2.grid(column=30,row=3)
b3_3.grid(column=29,row=3)
b3_4.grid(column=28,row=3)
b3_5.grid(column=27,row=3)
b3_6.grid(column=26,row=3)

# Row 2 Draw

# defining labels
nameb4_0 = ttk.Label(content, text="Byte 4")
nameb5_0 = ttk.Label(content, text="Byte 5")
nameb6_0 = ttk.Label(content, text="Byte 6")
nameb7_0 = ttk.Label(content, text="Byte 7")


# Defining number type
b4_0var = IntVar()
b4_1var = IntVar()
b4_2var = IntVar()
b4_3var = IntVar()
b4_4var = IntVar()
b4_5var = IntVar()
b4_6var = IntVar()
b4_7var = IntVar()

b5_0var = IntVar()
b5_1var = IntVar()
b5_2var = IntVar()
b5_3var = IntVar()
b5_4var = IntVar()
b5_5var = IntVar()
b5_6var = IntVar()
b5_7var = IntVar()

b6_0var = IntVar()
b6_1var = IntVar()
b6_2var = IntVar()
b6_3var = IntVar()
b6_4var = IntVar()
b6_5var = IntVar()
b6_6var = IntVar()
b6_7var = IntVar()

b7_0var = IntVar()
b7_1var = IntVar()
b7_2var = IntVar()
b7_3var = IntVar()
b7_4var = IntVar()
b7_5var = IntVar()
b7_6var = IntVar()
b7_7var = IntVar()

# Setting default button position
b4_0var.set(0)
b4_1var.set(0)
b4_2var.set(0)
b4_3var.set(0)
b4_4var.set(0)
b4_5var.set(0)
b4_6var.set(0)
b4_7var.set(0)

b5_0var.set(0)
b5_1var.set(0)
b5_2var.set(0)
b5_3var.set(0)
b5_4var.set(0)
b5_5var.set(0)
b5_6var.set(0)
b5_7var.set(0)

b6_0var.set(0)
b6_1var.set(0)
b6_2var.set(0)
b6_3var.set(0)
b6_4var.set(0)
b6_5var.set(0)
b6_6var.set(0)
b6_7var.set(0)

b7_0var.set(0)
b7_1var.set(0)
b7_2var.set(0)
b7_3var.set(0)
b7_4var.set(0)
b7_5var.set(0)
b7_6var.set(0)
b7_7var.set(0)

# Defining button
b4_0 = ttk.Checkbutton(content, command=run4, text="0", variable=b4_0var, onvalue=0x01, offvalue=0x00)
b4_1 = ttk.Checkbutton(content, command=run4, text="1", variable=b4_1var, onvalue=0x02, offvalue=0x00)
b4_2 = ttk.Checkbutton(content, command=run4, text="2", variable=b4_2var, onvalue=0x04, offvalue=0x00)
b4_3 = ttk.Checkbutton(content, command=run4, text="3", variable=b4_3var, onvalue=0x08, offvalue=0x00)
b4_4 = ttk.Checkbutton(content, command=run4, text="4", variable=b4_4var, onvalue=0x10, offvalue=0x00)
b4_5 = ttk.Checkbutton(content, command=run4, text="5", variable=b4_5var, onvalue=0x20, offvalue=0x00)
b4_6 = ttk.Checkbutton(content, command=run4, text="6", variable=b4_6var, onvalue=0x40, offvalue=0x00)
b4_7 = ttk.Checkbutton(content, command=run4, text="7", variable=b4_7var, onvalue=0x00, offvalue=0x00)

b5_0 = ttk.Checkbutton(content, command=run5, text="0", variable=b5_0var, onvalue=0x01, offvalue=0x00)
b5_1 = ttk.Checkbutton(content, command=run5, text="1", variable=b5_1var, onvalue=0x02, offvalue=0x00)
b5_2 = ttk.Checkbutton(content, command=run5, text="2", variable=b5_2var, onvalue=0x04, offvalue=0x00)
b5_3 = ttk.Checkbutton(content, command=run5, text="3", variable=b5_3var, onvalue=0x08, offvalue=0x00)
b5_4 = ttk.Checkbutton(content, command=run5, text="4", variable=b5_4var, onvalue=0x10, offvalue=0x00)
b5_5 = ttk.Checkbutton(content, command=run5, text="5", variable=b5_5var, onvalue=0x20, offvalue=0x00)
b5_6 = ttk.Checkbutton(content, command=run5, text="6", variable=b5_6var, onvalue=0x40, offvalue=0x00)
b5_7 = ttk.Checkbutton(content, command=run5, text="7", variable=b5_7var, onvalue=0x00, offvalue=0x00)

b6_0 = ttk.Checkbutton(content, command=run6, text="0", variable=b6_0var, onvalue=0x01, offvalue=0x00)
b6_1 = ttk.Checkbutton(content, command=run6, text="1", variable=b6_1var, onvalue=0x02, offvalue=0x00)
b6_2 = ttk.Checkbutton(content, command=run6, text="2", variable=b6_2var, onvalue=0x04, offvalue=0x00)
b6_3 = ttk.Checkbutton(content, command=run6, text="3", variable=b6_3var, onvalue=0x08, offvalue=0x00)
b6_4 = ttk.Checkbutton(content, command=run6, text="4", variable=b6_4var, onvalue=0x10, offvalue=0x00)
b6_5 = ttk.Checkbutton(content, command=run6, text="5", variable=b6_5var, onvalue=0x20, offvalue=0x00)
b6_6 = ttk.Checkbutton(content, command=run6, text="6", variable=b6_6var, onvalue=0x40, offvalue=0x00)
b6_7 = ttk.Checkbutton(content, command=run6, text="7", variable=b6_7var, onvalue=0x00, offvalue=0x00)

b7_0 = ttk.Checkbutton(content, command=run7, text="0", variable=b7_0var, onvalue=0x01, offvalue=0x00)
b7_1 = ttk.Checkbutton(content, command=run7, text="1", variable=b7_1var, onvalue=0x02, offvalue=0x00)
b7_2 = ttk.Checkbutton(content, command=run7, text="2", variable=b7_2var, onvalue=0x04, offvalue=0x00)
b7_3 = ttk.Checkbutton(content, command=run7, text="3", variable=b7_3var, onvalue=0x08, offvalue=0x00)
b7_4 = ttk.Checkbutton(content, command=run7, text="4", variable=b7_4var, onvalue=0x10, offvalue=0x00)
b7_5 = ttk.Checkbutton(content, command=run7, text="5", variable=b7_5var, onvalue=0x20, offvalue=0x00)
b7_6 = ttk.Checkbutton(content, command=run7, text="6", variable=b7_6var, onvalue=0x40, offvalue=0x00)
b7_7 = ttk.Checkbutton(content, command=run7, text="7", variable=b7_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb4_0.grid(column=4, row=5, columnspan=2)
nameb5_0.grid(column=12, row=5, columnspan=2)
nameb6_0.grid(column=20, row=5, columnspan=2)
nameb7_0.grid(column=28, row=5, columnspan=2)

# Placing buttons on grid
b4_0.grid(column=8,row=6, ipadx=10)
b4_1.grid(column=7,row=6)
b4_2.grid(column=6,row=6)
b4_3.grid(column=5,row=6)
b4_4.grid(column=4,row=6)
b4_5.grid(column=3,row=6)
b4_6.grid(column=2,row=6)

b5_0.grid(column=16,row=6, ipadx=10)
b5_1.grid(column=15,row=6)
b5_2.grid(column=14,row=6)
b5_3.grid(column=13,row=6)
b5_4.grid(column=12,row=6)
b5_5.grid(column=11,row=6)
b5_6.grid(column=10,row=6)

b6_0.grid(column=24,row=6, ipadx=10)
b6_1.grid(column=23,row=6)
b6_2.grid(column=22,row=6)
b6_3.grid(column=21,row=6)
b6_4.grid(column=20,row=6)
b6_5.grid(column=19,row=6)
b6_6.grid(column=18,row=6)

b7_0.grid(column=32,row=6)
b7_1.grid(column=31,row=6)
b7_2.grid(column=30,row=6)
b7_3.grid(column=29,row=6)
b7_4.grid(column=28,row=6)
b7_5.grid(column=27,row=6)
b7_6.grid(column=26,row=6)

# Row 3 Draw

# defining labels
nameb8_0 = ttk.Label(content, text="Byte 8")
nameb9_0 = ttk.Label(content, text="Byte 9")
nameb10_0 = ttk.Label(content, text="Byte 10")
nameb11_0 = ttk.Label(content, text="Byte 11")


# Defining number type
b8_0var = IntVar()
b8_1var = IntVar()
b8_2var = IntVar()
b8_3var = IntVar()
b8_4var = IntVar()
b8_5var = IntVar()
b8_6var = IntVar()
b8_7var = IntVar()

b9_0var = IntVar()
b9_1var = IntVar()
b9_2var = IntVar()
b9_3var = IntVar()
b9_4var = IntVar()
b9_5var = IntVar()
b9_6var = IntVar()
b9_7var = IntVar()

b10_0var = IntVar()
b10_1var = IntVar()
b10_2var = IntVar()
b10_3var = IntVar()
b10_4var = IntVar()
b10_5var = IntVar()
b10_6var = IntVar()
b10_7var = IntVar()

b11_0var = IntVar()
b11_1var = IntVar()
b11_2var = IntVar()
b11_3var = IntVar()
b11_4var = IntVar()
b11_5var = IntVar()
b11_6var = IntVar()
b11_7var = IntVar()

# Setting default button position
b8_0var.set(0)
b8_1var.set(0)
b8_2var.set(0)
b8_3var.set(0)
b8_4var.set(0)
b8_5var.set(0)
b8_6var.set(0)
b8_7var.set(0)

b9_0var.set(0)
b9_1var.set(0)
b9_2var.set(0)
b9_3var.set(0)
b9_4var.set(0)
b9_5var.set(0)
b9_6var.set(0)
b9_7var.set(0)

b10_0var.set(0)
b10_1var.set(0)
b10_2var.set(0)
b10_3var.set(0)
b10_4var.set(0)
b10_5var.set(0)
b10_6var.set(0)
b10_7var.set(0)

b11_0var.set(0)
b11_1var.set(0)
b11_2var.set(0)
b11_3var.set(0)
b11_4var.set(0)
b11_5var.set(0)
b11_6var.set(0)
b11_7var.set(0)

# Defining button
b8_0 = ttk.Checkbutton(content, command=run8, text="0", variable=b8_0var, onvalue=0x01, offvalue=0x00)
b8_1 = ttk.Checkbutton(content, command=run8, text="1", variable=b8_1var, onvalue=0x02, offvalue=0x00)
b8_2 = ttk.Checkbutton(content, command=run8, text="2", variable=b8_2var, onvalue=0x04, offvalue=0x00)
b8_3 = ttk.Checkbutton(content, command=run8, text="3", variable=b8_3var, onvalue=0x08, offvalue=0x00)
b8_4 = ttk.Checkbutton(content, command=run8, text="4", variable=b8_4var, onvalue=0x10, offvalue=0x00)
b8_5 = ttk.Checkbutton(content, command=run8, text="5", variable=b8_5var, onvalue=0x20, offvalue=0x00)
b8_6 = ttk.Checkbutton(content, command=run8, text="6", variable=b8_6var, onvalue=0x40, offvalue=0x00)
b8_7 = ttk.Checkbutton(content, command=run8, text="7", variable=b8_7var, onvalue=0x00, offvalue=0x00)

b9_0 = ttk.Checkbutton(content, command=run9, text="0", variable=b9_0var, onvalue=0x01, offvalue=0x00)
b9_1 = ttk.Checkbutton(content, command=run9, text="1", variable=b9_1var, onvalue=0x02, offvalue=0x00)
b9_2 = ttk.Checkbutton(content, command=run9, text="2", variable=b9_2var, onvalue=0x04, offvalue=0x00)
b9_3 = ttk.Checkbutton(content, command=run9, text="3", variable=b9_3var, onvalue=0x08, offvalue=0x00)
b9_4 = ttk.Checkbutton(content, command=run9, text="4", variable=b9_4var, onvalue=0x10, offvalue=0x00)
b9_5 = ttk.Checkbutton(content, command=run9, text="5", variable=b9_5var, onvalue=0x20, offvalue=0x00)
b9_6 = ttk.Checkbutton(content, command=run9, text="6", variable=b9_6var, onvalue=0x40, offvalue=0x00)
b9_7 = ttk.Checkbutton(content, command=run9, text="7", variable=b9_7var, onvalue=0x00, offvalue=0x00)

b10_0 = ttk.Checkbutton(content, command=run10, text="0", variable=b10_0var, onvalue=0x01, offvalue=0x00)
b10_1 = ttk.Checkbutton(content, command=run10, text="1", variable=b10_1var, onvalue=0x02, offvalue=0x00)
b10_2 = ttk.Checkbutton(content, command=run10, text="2", variable=b10_2var, onvalue=0x04, offvalue=0x00)
b10_3 = ttk.Checkbutton(content, command=run10, text="3", variable=b10_3var, onvalue=0x08, offvalue=0x00)
b10_4 = ttk.Checkbutton(content, command=run10, text="4", variable=b10_4var, onvalue=0x10, offvalue=0x00)
b10_5 = ttk.Checkbutton(content, command=run10, text="5", variable=b10_5var, onvalue=0x20, offvalue=0x00)
b10_6 = ttk.Checkbutton(content, command=run10, text="6", variable=b10_6var, onvalue=0x40, offvalue=0x00)
b10_7 = ttk.Checkbutton(content, command=run10, text="7", variable=b10_7var, onvalue=0x00, offvalue=0x00)

b11_0 = ttk.Checkbutton(content, command=run11, text="0", variable=b11_0var, onvalue=0x01, offvalue=0x00)
b11_1 = ttk.Checkbutton(content, command=run11, text="1", variable=b11_1var, onvalue=0x02, offvalue=0x00)
b11_2 = ttk.Checkbutton(content, command=run11, text="2", variable=b11_2var, onvalue=0x04, offvalue=0x00)
b11_3 = ttk.Checkbutton(content, command=run11, text="3", variable=b11_3var, onvalue=0x08, offvalue=0x00)
b11_4 = ttk.Checkbutton(content, command=run11, text="4", variable=b11_4var, onvalue=0x10, offvalue=0x00)
b11_5 = ttk.Checkbutton(content, command=run11, text="5", variable=b11_5var, onvalue=0x20, offvalue=0x00)
b11_6 = ttk.Checkbutton(content, command=run11, text="6", variable=b11_6var, onvalue=0x40, offvalue=0x00)
b11_7 = ttk.Checkbutton(content, command=run11, text="7", variable=b11_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb8_0.grid(column=4, row=11, columnspan=2)
nameb9_0.grid(column=12, row=11, columnspan=2)
nameb10_0.grid(column=20, row=11, columnspan=2)
nameb11_0.grid(column=28, row=11, columnspan=2)

# Placing buttons on grid
b8_0.grid(column=8,row=12, ipadx=10)
b8_1.grid(column=7,row=12)
b8_2.grid(column=6,row=12)
b8_3.grid(column=5,row=12)
b8_4.grid(column=4,row=12)
b8_5.grid(column=3,row=12)
b8_6.grid(column=2,row=12)

b9_0.grid(column=16,row=12, ipadx=10)
b9_1.grid(column=15,row=12)
b9_2.grid(column=14,row=12)
b9_3.grid(column=13,row=12)
b9_4.grid(column=12,row=12)
b9_5.grid(column=11,row=12)
b9_6.grid(column=10,row=12)

b10_0.grid(column=24,row=12, ipadx=10)
b10_1.grid(column=23,row=12)
b10_2.grid(column=22,row=12)
b10_3.grid(column=21,row=12)
b10_4.grid(column=20,row=12)
b10_5.grid(column=19,row=12)
b10_6.grid(column=18,row=12)

b11_0.grid(column=32,row=12)
b11_1.grid(column=31,row=12)
b11_2.grid(column=30,row=12)
b11_3.grid(column=29,row=12)
b11_4.grid(column=28,row=12)
b11_5.grid(column=27,row=12)
b11_6.grid(column=26,row=12)

# Row 4 Draw

# defining labels
nameb12_0 = ttk.Label(content, text="Byte 12")
nameb13_0 = ttk.Label(content, text="Byte 13")
nameb14_0 = ttk.Label(content, text="Byte 14")
nameb15_0 = ttk.Label(content, text="Byte 15")


# Defining number type
b12_0var = IntVar()
b12_1var = IntVar()
b12_2var = IntVar()
b12_3var = IntVar()
b12_4var = IntVar()
b12_5var = IntVar()
b12_6var = IntVar()
b12_7var = IntVar()

b13_0var = IntVar()
b13_1var = IntVar()
b13_2var = IntVar()
b13_3var = IntVar()
b13_4var = IntVar()
b13_5var = IntVar()
b13_6var = IntVar()
b13_7var = IntVar()

b14_0var = IntVar()
b14_1var = IntVar()
b14_2var = IntVar()
b14_3var = IntVar()
b14_4var = IntVar()
b14_5var = IntVar()
b14_6var = IntVar()
b14_7var = IntVar()

b15_0var = IntVar()
b15_1var = IntVar()
b15_2var = IntVar()
b15_3var = IntVar()
b15_4var = IntVar()
b15_5var = IntVar()
b15_6var = IntVar()
b15_7var = IntVar()

# Setting default button position
b12_0var.set(0)
b12_1var.set(0)
b12_2var.set(0)
b12_3var.set(0)
b12_4var.set(0)
b12_5var.set(0)
b12_6var.set(0)
b12_7var.set(0)

b13_0var.set(0)
b13_1var.set(0)
b13_2var.set(0)
b13_3var.set(0)
b13_4var.set(0)
b13_5var.set(0)
b13_6var.set(0)
b13_7var.set(0)

b14_0var.set(0)
b14_1var.set(0)
b14_2var.set(0)
b14_3var.set(0)
b14_4var.set(0)
b14_5var.set(0)
b14_6var.set(0)
b14_7var.set(0)

b15_0var.set(0)
b15_1var.set(0)
b15_2var.set(0)
b15_3var.set(0)
b15_4var.set(0)
b15_5var.set(0)
b15_6var.set(0)
b15_7var.set(0)

# Defining button
b12_0 = ttk.Checkbutton(content, command=run12, text="0", variable=b12_0var, onvalue=0x01, offvalue=0x00)
b12_1 = ttk.Checkbutton(content, command=run12, text="1", variable=b12_1var, onvalue=0x02, offvalue=0x00)
b12_2 = ttk.Checkbutton(content, command=run12, text="2", variable=b12_2var, onvalue=0x04, offvalue=0x00)
b12_3 = ttk.Checkbutton(content, command=run12, text="3", variable=b12_3var, onvalue=0x08, offvalue=0x00)
b12_4 = ttk.Checkbutton(content, command=run12, text="4", variable=b12_4var, onvalue=0x10, offvalue=0x00)
b12_5 = ttk.Checkbutton(content, command=run12, text="5", variable=b12_5var, onvalue=0x20, offvalue=0x00)
b12_6 = ttk.Checkbutton(content, command=run12, text="6", variable=b12_6var, onvalue=0x40, offvalue=0x00)
b12_7 = ttk.Checkbutton(content, command=run12, text="7", variable=b12_7var, onvalue=0x00, offvalue=0x00)

b13_0 = ttk.Checkbutton(content, command=run13, text="0", variable=b13_0var, onvalue=0x01, offvalue=0x00)
b13_1 = ttk.Checkbutton(content, command=run13, text="1", variable=b13_1var, onvalue=0x02, offvalue=0x00)
b13_2 = ttk.Checkbutton(content, command=run13, text="2", variable=b13_2var, onvalue=0x04, offvalue=0x00)
b13_3 = ttk.Checkbutton(content, command=run13, text="3", variable=b13_3var, onvalue=0x08, offvalue=0x00)
b13_4 = ttk.Checkbutton(content, command=run13, text="4", variable=b13_4var, onvalue=0x10, offvalue=0x00)
b13_5 = ttk.Checkbutton(content, command=run13, text="5", variable=b13_5var, onvalue=0x20, offvalue=0x00)
b13_6 = ttk.Checkbutton(content, command=run13, text="6", variable=b13_6var, onvalue=0x40, offvalue=0x00)
b13_7 = ttk.Checkbutton(content, command=run13, text="7", variable=b13_7var, onvalue=0x00, offvalue=0x00)

b14_0 = ttk.Checkbutton(content, command=run14, text="0", variable=b14_0var, onvalue=0x01, offvalue=0x00)
b14_1 = ttk.Checkbutton(content, command=run14, text="1", variable=b14_1var, onvalue=0x02, offvalue=0x00)
b14_2 = ttk.Checkbutton(content, command=run14, text="2", variable=b14_2var, onvalue=0x04, offvalue=0x00)
b14_3 = ttk.Checkbutton(content, command=run14, text="3", variable=b14_3var, onvalue=0x08, offvalue=0x00)
b14_4 = ttk.Checkbutton(content, command=run14, text="4", variable=b14_4var, onvalue=0x10, offvalue=0x00)
b14_5 = ttk.Checkbutton(content, command=run14, text="5", variable=b14_5var, onvalue=0x20, offvalue=0x00)
b14_6 = ttk.Checkbutton(content, command=run14, text="6", variable=b14_6var, onvalue=0x40, offvalue=0x00)
b14_7 = ttk.Checkbutton(content, command=run14, text="7", variable=b14_7var, onvalue=0x00, offvalue=0x00)

b15_0 = ttk.Checkbutton(content, command=run15, text="0", variable=b15_0var, onvalue=0x01, offvalue=0x00)
b15_1 = ttk.Checkbutton(content, command=run15, text="1", variable=b15_1var, onvalue=0x02, offvalue=0x00)
b15_2 = ttk.Checkbutton(content, command=run15, text="2", variable=b15_2var, onvalue=0x04, offvalue=0x00)
b15_3 = ttk.Checkbutton(content, command=run15, text="3", variable=b15_3var, onvalue=0x08, offvalue=0x00)
b15_4 = ttk.Checkbutton(content, command=run15, text="4", variable=b15_4var, onvalue=0x10, offvalue=0x00)
b15_5 = ttk.Checkbutton(content, command=run15, text="5", variable=b15_5var, onvalue=0x20, offvalue=0x00)
b15_6 = ttk.Checkbutton(content, command=run15, text="6", variable=b15_6var, onvalue=0x40, offvalue=0x00)
b15_7 = ttk.Checkbutton(content, command=run15, text="7", variable=b15_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb12_0.grid(column=4, row=17, columnspan=2)
nameb13_0.grid(column=12, row=17, columnspan=2)
nameb14_0.grid(column=20, row=17, columnspan=2)
nameb15_0.grid(column=28, row=17, columnspan=2)

# Placing buttons on grid
b12_0.grid(column=8,row=18, ipadx=10)
b12_1.grid(column=7,row=18)
b12_2.grid(column=6,row=18)
b12_3.grid(column=5,row=18)
b12_4.grid(column=4,row=18)
b12_5.grid(column=3,row=18)
b12_6.grid(column=2,row=18)

b13_0.grid(column=16,row=18, ipadx=10)
b13_1.grid(column=15,row=18)
b13_2.grid(column=14,row=18)
b13_3.grid(column=13,row=18)
b13_4.grid(column=12,row=18)
b13_5.grid(column=11,row=18)
b13_6.grid(column=10,row=18)

b14_0.grid(column=24,row=18, ipadx=10)
b14_1.grid(column=23,row=18)
b14_2.grid(column=22,row=18)
b14_3.grid(column=21,row=18)
b14_4.grid(column=20,row=18)
b14_5.grid(column=19,row=18)
b14_6.grid(column=18,row=18)

b15_0.grid(column=32,row=18)
b15_1.grid(column=31,row=18)
b15_2.grid(column=30,row=18)
b15_3.grid(column=29,row=18)
b15_4.grid(column=28,row=18)
b15_5.grid(column=27,row=18)
b15_6.grid(column=26,row=18)

# Row 5 Draw

# defining labels
nameb16_0 = ttk.Label(content, text="Byte 16")
nameb17_0 = ttk.Label(content, text="Byte 17")
nameb18_0 = ttk.Label(content, text="Byte 18")
nameb19_0 = ttk.Label(content, text="Byte 19")


# Defining number type
b16_0var = IntVar()
b16_1var = IntVar()
b16_2var = IntVar()
b16_3var = IntVar()
b16_4var = IntVar()
b16_5var = IntVar()
b16_6var = IntVar()
b16_7var = IntVar()

b17_0var = IntVar()
b17_1var = IntVar()
b17_2var = IntVar()
b17_3var = IntVar()
b17_4var = IntVar()
b17_5var = IntVar()
b17_6var = IntVar()
b17_7var = IntVar()

b18_0var = IntVar()
b18_1var = IntVar()
b18_2var = IntVar()
b18_3var = IntVar()
b18_4var = IntVar()
b18_5var = IntVar()
b18_6var = IntVar()
b18_7var = IntVar()

b19_0var = IntVar()
b19_1var = IntVar()
b19_2var = IntVar()
b19_3var = IntVar()
b19_4var = IntVar()
b19_5var = IntVar()
b19_6var = IntVar()
b19_7var = IntVar()

# Setting default button position
b16_0var.set(0)
b16_1var.set(0)
b16_2var.set(0)
b16_3var.set(0)
b16_4var.set(0)
b16_5var.set(0)
b16_6var.set(0)
b16_7var.set(0)

b17_0var.set(0)
b17_1var.set(0)
b17_2var.set(0)
b17_3var.set(0)
b17_4var.set(0)
b17_5var.set(0)
b17_6var.set(0)
b17_7var.set(0)

b18_0var.set(0)
b18_1var.set(0)
b18_2var.set(0)
b18_3var.set(0)
b18_4var.set(0)
b18_5var.set(0)
b18_6var.set(0)
b18_7var.set(0)

b19_0var.set(0)
b19_1var.set(0)
b19_2var.set(0)
b19_3var.set(0)
b19_4var.set(0)
b19_5var.set(0)
b19_6var.set(0)
b19_7var.set(0)

# Defining button
b16_0 = ttk.Checkbutton(content, command=run16, text="0", variable=b16_0var, onvalue=0x01, offvalue=0x00)
b16_1 = ttk.Checkbutton(content, command=run16, text="1", variable=b16_1var, onvalue=0x02, offvalue=0x00)
b16_2 = ttk.Checkbutton(content, command=run16, text="2", variable=b16_2var, onvalue=0x04, offvalue=0x00)
b16_3 = ttk.Checkbutton(content, command=run16, text="3", variable=b16_3var, onvalue=0x08, offvalue=0x00)
b16_4 = ttk.Checkbutton(content, command=run16, text="4", variable=b16_4var, onvalue=0x10, offvalue=0x00)
b16_5 = ttk.Checkbutton(content, command=run16, text="5", variable=b16_5var, onvalue=0x20, offvalue=0x00)
b16_6 = ttk.Checkbutton(content, command=run16, text="6", variable=b16_6var, onvalue=0x40, offvalue=0x00)
b16_7 = ttk.Checkbutton(content, command=run16, text="7", variable=b16_7var, onvalue=0x00, offvalue=0x00)

b17_0 = ttk.Checkbutton(content, command=run17, text="0", variable=b17_0var, onvalue=0x01, offvalue=0x00)
b17_1 = ttk.Checkbutton(content, command=run17, text="1", variable=b17_1var, onvalue=0x02, offvalue=0x00)
b17_2 = ttk.Checkbutton(content, command=run17, text="2", variable=b17_2var, onvalue=0x04, offvalue=0x00)
b17_3 = ttk.Checkbutton(content, command=run17, text="3", variable=b17_3var, onvalue=0x08, offvalue=0x00)
b17_4 = ttk.Checkbutton(content, command=run17, text="4", variable=b17_4var, onvalue=0x10, offvalue=0x00)
b17_5 = ttk.Checkbutton(content, command=run17, text="5", variable=b17_5var, onvalue=0x20, offvalue=0x00)
b17_6 = ttk.Checkbutton(content, command=run17, text="6", variable=b17_6var, onvalue=0x40, offvalue=0x00)
b17_7 = ttk.Checkbutton(content, command=run17, text="7", variable=b17_7var, onvalue=0x00, offvalue=0x00)

b18_0 = ttk.Checkbutton(content, command=run18, text="0", variable=b18_0var, onvalue=0x01, offvalue=0x00)
b18_1 = ttk.Checkbutton(content, command=run18, text="1", variable=b18_1var, onvalue=0x02, offvalue=0x00)
b18_2 = ttk.Checkbutton(content, command=run18, text="2", variable=b18_2var, onvalue=0x04, offvalue=0x00)
b18_3 = ttk.Checkbutton(content, command=run18, text="3", variable=b18_3var, onvalue=0x08, offvalue=0x00)
b18_4 = ttk.Checkbutton(content, command=run18, text="4", variable=b18_4var, onvalue=0x10, offvalue=0x00)
b18_5 = ttk.Checkbutton(content, command=run18, text="5", variable=b18_5var, onvalue=0x20, offvalue=0x00)
b18_6 = ttk.Checkbutton(content, command=run18, text="6", variable=b18_6var, onvalue=0x40, offvalue=0x00)
b18_7 = ttk.Checkbutton(content, command=run18, text="7", variable=b18_7var, onvalue=0x00, offvalue=0x00)

b19_0 = ttk.Checkbutton(content, command=run19, text="0", variable=b19_0var, onvalue=0x01, offvalue=0x00)
b19_1 = ttk.Checkbutton(content, command=run19, text="1", variable=b19_1var, onvalue=0x02, offvalue=0x00)
b19_2 = ttk.Checkbutton(content, command=run19, text="2", variable=b19_2var, onvalue=0x04, offvalue=0x00)
b19_3 = ttk.Checkbutton(content, command=run19, text="3", variable=b19_3var, onvalue=0x08, offvalue=0x00)
b19_4 = ttk.Checkbutton(content, command=run19, text="4", variable=b19_4var, onvalue=0x10, offvalue=0x00)
b19_5 = ttk.Checkbutton(content, command=run19, text="5", variable=b19_5var, onvalue=0x20, offvalue=0x00)
b19_6 = ttk.Checkbutton(content, command=run19, text="6", variable=b19_6var, onvalue=0x40, offvalue=0x00)
b19_7 = ttk.Checkbutton(content, command=run19, text="7", variable=b19_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb16_0.grid(column=4, row=23, columnspan=2)
nameb17_0.grid(column=12, row=23, columnspan=2)
nameb18_0.grid(column=20, row=23, columnspan=2)
nameb19_0.grid(column=28, row=23, columnspan=2)

# Placing buttons on grid
b16_0.grid(column=8,row=24, ipadx=10)
b16_1.grid(column=7,row=24)
b16_2.grid(column=6,row=24)
b16_3.grid(column=5,row=24)
b16_4.grid(column=4,row=24)
b16_5.grid(column=3,row=24)
b16_6.grid(column=2,row=24)

b17_0.grid(column=16,row=24, ipadx=10)
b17_1.grid(column=15,row=24)
b17_2.grid(column=14,row=24)
b17_3.grid(column=13,row=24)
b17_4.grid(column=12,row=24)
b17_5.grid(column=11,row=24)
b17_6.grid(column=10,row=24)

b18_0.grid(column=24,row=24, ipadx=10)
b18_1.grid(column=23,row=24)
b18_2.grid(column=22,row=24)
b18_3.grid(column=21,row=24)
b18_4.grid(column=20,row=24)
b18_5.grid(column=19,row=24)
b18_6.grid(column=18,row=24)

b19_0.grid(column=32,row=24)
b19_1.grid(column=31,row=24)
b19_2.grid(column=30,row=24)
b19_3.grid(column=29,row=24)
b19_4.grid(column=28,row=24)
b19_5.grid(column=27,row=24)
b19_6.grid(column=26,row=24)

# Row 6 Draw

# defining labels
nameb20_0 = ttk.Label(content, text="Byte 20")
nameb21_0 = ttk.Label(content, text="Byte 21")
nameb22_0 = ttk.Label(content, text="Byte 22")
nameb23_0 = ttk.Label(content, text="Byte 23")


# Defining number type
b20_0var = IntVar()
b20_1var = IntVar()
b20_2var = IntVar()
b20_3var = IntVar()
b20_4var = IntVar()
b20_5var = IntVar()
b20_6var = IntVar()
b20_7var = IntVar()

b21_0var = IntVar()
b21_1var = IntVar()
b21_2var = IntVar()
b21_3var = IntVar()
b21_4var = IntVar()
b21_5var = IntVar()
b21_6var = IntVar()
b21_7var = IntVar()

b22_0var = IntVar()
b22_1var = IntVar()
b22_2var = IntVar()
b22_3var = IntVar()
b22_4var = IntVar()
b22_5var = IntVar()
b22_6var = IntVar()
b22_7var = IntVar()

b23_0var = IntVar()
b23_1var = IntVar()
b23_2var = IntVar()
b23_3var = IntVar()
b23_4var = IntVar()
b23_5var = IntVar()
b23_6var = IntVar()
b23_7var = IntVar()

# Setting default button position
b20_0var.set(0)
b20_1var.set(0)
b20_2var.set(0)
b20_3var.set(0)
b20_4var.set(0)
b20_5var.set(0)
b20_6var.set(0)
b20_7var.set(0)

b21_0var.set(0)
b21_1var.set(0)
b21_2var.set(0)
b21_3var.set(0)
b21_4var.set(0)
b21_5var.set(0)
b21_6var.set(0)
b21_7var.set(0)

b22_0var.set(0)
b22_1var.set(0)
b22_2var.set(0)
b22_3var.set(0)
b22_4var.set(0)
b22_5var.set(0)
b22_6var.set(0)
b22_7var.set(0)

b23_0var.set(0)
b23_1var.set(0)
b23_2var.set(0)
b23_3var.set(0)
b23_4var.set(0)
b23_5var.set(0)
b23_6var.set(0)
b23_7var.set(0)

# Defining button
b20_0 = ttk.Checkbutton(content, command=run20, text="0", variable=b20_0var, onvalue=0x01, offvalue=0x00)
b20_1 = ttk.Checkbutton(content, command=run20, text="1", variable=b20_1var, onvalue=0x02, offvalue=0x00)
b20_2 = ttk.Checkbutton(content, command=run20, text="2", variable=b20_2var, onvalue=0x04, offvalue=0x00)
b20_3 = ttk.Checkbutton(content, command=run20, text="3", variable=b20_3var, onvalue=0x08, offvalue=0x00)
b20_4 = ttk.Checkbutton(content, command=run20, text="4", variable=b20_4var, onvalue=0x10, offvalue=0x00)
b20_5 = ttk.Checkbutton(content, command=run20, text="5", variable=b20_5var, onvalue=0x20, offvalue=0x00)
b20_6 = ttk.Checkbutton(content, command=run20, text="6", variable=b20_6var, onvalue=0x40, offvalue=0x00)
b20_7 = ttk.Checkbutton(content, command=run20, text="7", variable=b20_7var, onvalue=0x00, offvalue=0x00)

b21_0 = ttk.Checkbutton(content, command=run21, text="0", variable=b21_0var, onvalue=0x01, offvalue=0x00)
b21_1 = ttk.Checkbutton(content, command=run21, text="1", variable=b21_1var, onvalue=0x02, offvalue=0x00)
b21_2 = ttk.Checkbutton(content, command=run21, text="2", variable=b21_2var, onvalue=0x04, offvalue=0x00)
b21_3 = ttk.Checkbutton(content, command=run21, text="3", variable=b21_3var, onvalue=0x08, offvalue=0x00)
b21_4 = ttk.Checkbutton(content, command=run21, text="4", variable=b21_4var, onvalue=0x10, offvalue=0x00)
b21_5 = ttk.Checkbutton(content, command=run21, text="5", variable=b21_5var, onvalue=0x20, offvalue=0x00)
b21_6 = ttk.Checkbutton(content, command=run21, text="6", variable=b21_6var, onvalue=0x40, offvalue=0x00)
b21_7 = ttk.Checkbutton(content, command=run21, text="7", variable=b21_7var, onvalue=0x00, offvalue=0x00)

b22_0 = ttk.Checkbutton(content, command=run22, text="0", variable=b22_0var, onvalue=0x01, offvalue=0x00)
b22_1 = ttk.Checkbutton(content, command=run22, text="1", variable=b22_1var, onvalue=0x02, offvalue=0x00)
b22_2 = ttk.Checkbutton(content, command=run22, text="2", variable=b22_2var, onvalue=0x04, offvalue=0x00)
b22_3 = ttk.Checkbutton(content, command=run22, text="3", variable=b22_3var, onvalue=0x08, offvalue=0x00)
b22_4 = ttk.Checkbutton(content, command=run22, text="4", variable=b22_4var, onvalue=0x10, offvalue=0x00)
b22_5 = ttk.Checkbutton(content, command=run22, text="5", variable=b22_5var, onvalue=0x20, offvalue=0x00)
b22_6 = ttk.Checkbutton(content, command=run22, text="6", variable=b22_6var, onvalue=0x40, offvalue=0x00)
b22_7 = ttk.Checkbutton(content, command=run22, text="7", variable=b22_7var, onvalue=0x00, offvalue=0x00)

b23_0 = ttk.Checkbutton(content, command=run23, text="0", variable=b23_0var, onvalue=0x01, offvalue=0x00)
b23_1 = ttk.Checkbutton(content, command=run23, text="1", variable=b23_1var, onvalue=0x02, offvalue=0x00)
b23_2 = ttk.Checkbutton(content, command=run23, text="2", variable=b23_2var, onvalue=0x04, offvalue=0x00)
b23_3 = ttk.Checkbutton(content, command=run23, text="3", variable=b23_3var, onvalue=0x08, offvalue=0x00)
b23_4 = ttk.Checkbutton(content, command=run23, text="4", variable=b23_4var, onvalue=0x10, offvalue=0x00)
b23_5 = ttk.Checkbutton(content, command=run23, text="5", variable=b23_5var, onvalue=0x20, offvalue=0x00)
b23_6 = ttk.Checkbutton(content, command=run23, text="6", variable=b23_6var, onvalue=0x40, offvalue=0x00)
b23_7 = ttk.Checkbutton(content, command=run23, text="7", variable=b23_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb20_0.grid(column=4, row=29, columnspan=2)
nameb21_0.grid(column=12, row=29, columnspan=2)
nameb22_0.grid(column=20, row=29, columnspan=2)
nameb23_0.grid(column=28, row=29, columnspan=2)

# Placing buttons on grid
b20_0.grid(column=8,row=30, ipadx=10)
b20_1.grid(column=7,row=30)
b20_2.grid(column=6,row=30)
b20_3.grid(column=5,row=30)
b20_4.grid(column=4,row=30)
b20_5.grid(column=3,row=30)
b20_6.grid(column=2,row=30)

b21_0.grid(column=16,row=30, ipadx=10)
b21_1.grid(column=15,row=30)
b21_2.grid(column=14,row=30)
b21_3.grid(column=13,row=30)
b21_4.grid(column=12,row=30)
b21_5.grid(column=11,row=30)
b21_6.grid(column=10,row=30)

b22_0.grid(column=24,row=30, ipadx=10)
b22_1.grid(column=23,row=30)
b22_2.grid(column=22,row=30)
b22_3.grid(column=21,row=30)
b22_4.grid(column=20,row=30)
b22_5.grid(column=19,row=30)
b22_6.grid(column=18,row=30)

b23_0.grid(column=32,row=30)
b23_1.grid(column=31,row=30)
b23_2.grid(column=30,row=30)
b23_3.grid(column=29,row=30)
b23_4.grid(column=28,row=30)
b23_5.grid(column=27,row=30)
b23_6.grid(column=26,row=30)

# Row 7 Draw

# defining labels
nameb24_0 = ttk.Label(content, text="Byte 24")
nameb25_0 = ttk.Label(content, text="Byte 25")
nameb26_0 = ttk.Label(content, text="Byte 26")
nameb27_0 = ttk.Label(content, text="Byte 27")


# Defining number type
b24_0var = IntVar()
b24_1var = IntVar()
b24_2var = IntVar()
b24_3var = IntVar()
b24_4var = IntVar()
b24_5var = IntVar()
b24_6var = IntVar()
b24_7var = IntVar()

b25_0var = IntVar()
b25_1var = IntVar()
b25_2var = IntVar()
b25_3var = IntVar()
b25_4var = IntVar()
b25_5var = IntVar()
b25_6var = IntVar()
b25_7var = IntVar()

b26_0var = IntVar()
b26_1var = IntVar()
b26_2var = IntVar()
b26_3var = IntVar()
b26_4var = IntVar()
b26_5var = IntVar()
b26_6var = IntVar()
b26_7var = IntVar()

b27_0var = IntVar()
b27_1var = IntVar()
b27_2var = IntVar()
b27_3var = IntVar()
b27_4var = IntVar()
b27_5var = IntVar()
b27_6var = IntVar()
b27_7var = IntVar()

# Setting default button position
b24_0var.set(0)
b24_1var.set(0)
b24_2var.set(0)
b24_3var.set(0)
b24_4var.set(0)
b24_5var.set(0)
b24_6var.set(0)
b24_7var.set(0)

b25_0var.set(0)
b25_1var.set(0)
b25_2var.set(0)
b25_3var.set(0)
b25_4var.set(0)
b25_5var.set(0)
b25_6var.set(0)
b25_7var.set(0)

b26_0var.set(0)
b26_1var.set(0)
b26_2var.set(0)
b26_3var.set(0)
b26_4var.set(0)
b26_5var.set(0)
b26_6var.set(0)
b26_7var.set(0)

b27_0var.set(0)
b27_1var.set(0)
b27_2var.set(0)
b27_3var.set(0)
b27_4var.set(0)
b27_5var.set(0)
b27_6var.set(0)
b27_7var.set(0)

# Defining button
b24_0 = ttk.Checkbutton(content, command=run24, text="0", variable=b24_0var, onvalue=0x01, offvalue=0x00)
b24_1 = ttk.Checkbutton(content, command=run24, text="1", variable=b24_1var, onvalue=0x02, offvalue=0x00)
b24_2 = ttk.Checkbutton(content, command=run24, text="2", variable=b24_2var, onvalue=0x04, offvalue=0x00)
b24_3 = ttk.Checkbutton(content, command=run24, text="3", variable=b24_3var, onvalue=0x08, offvalue=0x00)
b24_4 = ttk.Checkbutton(content, command=run24, text="4", variable=b24_4var, onvalue=0x10, offvalue=0x00)
b24_5 = ttk.Checkbutton(content, command=run24, text="5", variable=b24_5var, onvalue=0x20, offvalue=0x00)
b24_6 = ttk.Checkbutton(content, command=run24, text="6", variable=b24_6var, onvalue=0x40, offvalue=0x00)
b24_7 = ttk.Checkbutton(content, command=run24, text="7", variable=b24_7var, onvalue=0x00, offvalue=0x00)

b25_0 = ttk.Checkbutton(content, command=run25, text="0", variable=b25_0var, onvalue=0x01, offvalue=0x00)
b25_1 = ttk.Checkbutton(content, command=run25, text="1", variable=b25_1var, onvalue=0x02, offvalue=0x00)
b25_2 = ttk.Checkbutton(content, command=run25, text="2", variable=b25_2var, onvalue=0x04, offvalue=0x00)
b25_3 = ttk.Checkbutton(content, command=run25, text="3", variable=b25_3var, onvalue=0x08, offvalue=0x00)
b25_4 = ttk.Checkbutton(content, command=run25, text="4", variable=b25_4var, onvalue=0x10, offvalue=0x00)
b25_5 = ttk.Checkbutton(content, command=run25, text="5", variable=b25_5var, onvalue=0x20, offvalue=0x00)
b25_6 = ttk.Checkbutton(content, command=run25, text="6", variable=b25_6var, onvalue=0x40, offvalue=0x00)
b25_7 = ttk.Checkbutton(content, command=run25, text="7", variable=b25_7var, onvalue=0x00, offvalue=0x00)

b26_0 = ttk.Checkbutton(content, command=run26, text="0", variable=b26_0var, onvalue=0x01, offvalue=0x00)
b26_1 = ttk.Checkbutton(content, command=run26, text="1", variable=b26_1var, onvalue=0x02, offvalue=0x00)
b26_2 = ttk.Checkbutton(content, command=run26, text="2", variable=b26_2var, onvalue=0x04, offvalue=0x00)
b26_3 = ttk.Checkbutton(content, command=run26, text="3", variable=b26_3var, onvalue=0x08, offvalue=0x00)
b26_4 = ttk.Checkbutton(content, command=run26, text="4", variable=b26_4var, onvalue=0x10, offvalue=0x00)
b26_5 = ttk.Checkbutton(content, command=run26, text="5", variable=b26_5var, onvalue=0x20, offvalue=0x00)
b26_6 = ttk.Checkbutton(content, command=run26, text="6", variable=b26_6var, onvalue=0x40, offvalue=0x00)
b26_7 = ttk.Checkbutton(content, command=run26, text="7", variable=b26_7var, onvalue=0x00, offvalue=0x00)

b27_0 = ttk.Checkbutton(content, command=run27, text="0", variable=b27_0var, onvalue=0x01, offvalue=0x00)
b27_1 = ttk.Checkbutton(content, command=run27, text="1", variable=b27_1var, onvalue=0x02, offvalue=0x00)
b27_2 = ttk.Checkbutton(content, command=run27, text="2", variable=b27_2var, onvalue=0x04, offvalue=0x00)
b27_3 = ttk.Checkbutton(content, command=run27, text="3", variable=b27_3var, onvalue=0x08, offvalue=0x00)
b27_4 = ttk.Checkbutton(content, command=run27, text="4", variable=b27_4var, onvalue=0x10, offvalue=0x00)
b27_5 = ttk.Checkbutton(content, command=run27, text="5", variable=b27_5var, onvalue=0x20, offvalue=0x00)
b27_6 = ttk.Checkbutton(content, command=run27, text="6", variable=b27_6var, onvalue=0x40, offvalue=0x00)
b27_7 = ttk.Checkbutton(content, command=run27, text="7", variable=b27_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb24_0.grid(column=4, row=35, columnspan=2)
nameb25_0.grid(column=12, row=35, columnspan=2)
nameb26_0.grid(column=20, row=35, columnspan=2)
nameb27_0.grid(column=28, row=35, columnspan=2)

# Placing buttons on grid
b24_0.grid(column=8,row=36, ipadx=10)
b24_1.grid(column=7,row=36)
b24_2.grid(column=6,row=36)
b24_3.grid(column=5,row=36)
b24_4.grid(column=4,row=36)
b24_5.grid(column=3,row=36)
b24_6.grid(column=2,row=36)

b25_0.grid(column=16,row=36, ipadx=10)
b25_1.grid(column=15,row=36)
b25_2.grid(column=14,row=36)
b25_3.grid(column=13,row=36)
b25_4.grid(column=12,row=36)
b25_5.grid(column=11,row=36)
b25_6.grid(column=10,row=36)

b26_0.grid(column=24,row=36, ipadx=10)
b26_1.grid(column=23,row=36)
b26_2.grid(column=22,row=36)
b26_3.grid(column=21,row=36)
b26_4.grid(column=20,row=36)
b26_5.grid(column=19,row=36)
b26_6.grid(column=18,row=36)

b27_0.grid(column=32,row=36)
b27_1.grid(column=31,row=36)
b27_2.grid(column=30,row=36)
b27_3.grid(column=29,row=36)
b27_4.grid(column=28,row=36)
b27_5.grid(column=27,row=36)
b27_6.grid(column=26,row=36)

# Row 8 Draw

# defining labels
nameb28_0 = ttk.Label(content, text="Byte 28")
nameb29_0 = ttk.Label(content, text="Byte 29")
nameb30_0 = ttk.Label(content, text="Byte 30")
nameb31_0 = ttk.Label(content, text="Byte 31")


# Defining number type
b28_0var = IntVar()
b28_1var = IntVar()
b28_2var = IntVar()
b28_3var = IntVar()
b28_4var = IntVar()
b28_5var = IntVar()
b28_6var = IntVar()
b28_7var = IntVar()

b29_0var = IntVar()
b29_1var = IntVar()
b29_2var = IntVar()
b29_3var = IntVar()
b29_4var = IntVar()
b29_5var = IntVar()
b29_6var = IntVar()
b29_7var = IntVar()

b30_0var = IntVar()
b30_1var = IntVar()
b30_2var = IntVar()
b30_3var = IntVar()
b30_4var = IntVar()
b30_5var = IntVar()
b30_6var = IntVar()
b30_7var = IntVar()

b31_0var = IntVar()
b31_1var = IntVar()
b31_2var = IntVar()
b31_3var = IntVar()
b31_4var = IntVar()
b31_5var = IntVar()
b31_6var = IntVar()
b31_7var = IntVar()

# Setting default button position
b28_0var.set(0)
b28_1var.set(0)
b28_2var.set(0)
b28_3var.set(0)
b28_4var.set(0)
b28_5var.set(0)
b28_6var.set(0)
b28_7var.set(0)

b29_0var.set(0)
b29_1var.set(0)
b29_2var.set(0)
b29_3var.set(0)
b29_4var.set(0)
b29_5var.set(0)
b29_6var.set(0)
b29_7var.set(0)

b30_0var.set(0)
b30_1var.set(0)
b30_2var.set(0)
b30_3var.set(0)
b30_4var.set(0)
b30_5var.set(0)
b30_6var.set(0)
b30_7var.set(0)

b31_0var.set(0)
b31_1var.set(0)
b31_2var.set(0)
b31_3var.set(0)
b31_4var.set(0)
b31_5var.set(0)
b31_6var.set(0)
b31_7var.set(0)

# Defining button
b28_0 = ttk.Checkbutton(content, command=run28, text="0", variable=b28_0var, onvalue=0x01, offvalue=0x00)
b28_1 = ttk.Checkbutton(content, command=run28, text="1", variable=b28_1var, onvalue=0x02, offvalue=0x00)
b28_2 = ttk.Checkbutton(content, command=run28, text="2", variable=b28_2var, onvalue=0x04, offvalue=0x00)
b28_3 = ttk.Checkbutton(content, command=run28, text="3", variable=b28_3var, onvalue=0x08, offvalue=0x00)
b28_4 = ttk.Checkbutton(content, command=run28, text="4", variable=b28_4var, onvalue=0x10, offvalue=0x00)
b28_5 = ttk.Checkbutton(content, command=run28, text="5", variable=b28_5var, onvalue=0x20, offvalue=0x00)
b28_6 = ttk.Checkbutton(content, command=run28, text="6", variable=b28_6var, onvalue=0x40, offvalue=0x00)
b28_7 = ttk.Checkbutton(content, command=run28, text="7", variable=b28_7var, onvalue=0x00, offvalue=0x00)

b29_0 = ttk.Checkbutton(content, command=run29, text="0", variable=b29_0var, onvalue=0x01, offvalue=0x00)
b29_1 = ttk.Checkbutton(content, command=run29, text="1", variable=b29_1var, onvalue=0x02, offvalue=0x00)
b29_2 = ttk.Checkbutton(content, command=run29, text="2", variable=b29_2var, onvalue=0x04, offvalue=0x00)
b29_3 = ttk.Checkbutton(content, command=run29, text="3", variable=b29_3var, onvalue=0x08, offvalue=0x00)
b29_4 = ttk.Checkbutton(content, command=run29, text="4", variable=b29_4var, onvalue=0x10, offvalue=0x00)
b29_5 = ttk.Checkbutton(content, command=run29, text="5", variable=b29_5var, onvalue=0x20, offvalue=0x00)
b29_6 = ttk.Checkbutton(content, command=run29, text="6", variable=b29_6var, onvalue=0x40, offvalue=0x00)
b29_7 = ttk.Checkbutton(content, command=run29, text="7", variable=b29_7var, onvalue=0x00, offvalue=0x00)

b30_0 = ttk.Checkbutton(content, command=run30, text="0", variable=b30_0var, onvalue=0x01, offvalue=0x00)
b30_1 = ttk.Checkbutton(content, command=run30, text="1", variable=b30_1var, onvalue=0x02, offvalue=0x00)
b30_2 = ttk.Checkbutton(content, command=run30, text="2", variable=b30_2var, onvalue=0x04, offvalue=0x00)
b30_3 = ttk.Checkbutton(content, command=run30, text="3", variable=b30_3var, onvalue=0x08, offvalue=0x00)
b30_4 = ttk.Checkbutton(content, command=run30, text="4", variable=b30_4var, onvalue=0x10, offvalue=0x00)
b30_5 = ttk.Checkbutton(content, command=run30, text="5", variable=b30_5var, onvalue=0x20, offvalue=0x00)
b30_6 = ttk.Checkbutton(content, command=run30, text="6", variable=b30_6var, onvalue=0x40, offvalue=0x00)
b30_7 = ttk.Checkbutton(content, command=run30, text="7", variable=b30_7var, onvalue=0x00, offvalue=0x00)

b31_0 = ttk.Checkbutton(content, command=run31, text="0", variable=b31_0var, onvalue=0x01, offvalue=0x00)
b31_1 = ttk.Checkbutton(content, command=run31, text="1", variable=b31_1var, onvalue=0x02, offvalue=0x00)
b31_2 = ttk.Checkbutton(content, command=run31, text="2", variable=b31_2var, onvalue=0x04, offvalue=0x00)
b31_3 = ttk.Checkbutton(content, command=run31, text="3", variable=b31_3var, onvalue=0x08, offvalue=0x00)
b31_4 = ttk.Checkbutton(content, command=run31, text="4", variable=b31_4var, onvalue=0x10, offvalue=0x00)
b31_5 = ttk.Checkbutton(content, command=run31, text="5", variable=b31_5var, onvalue=0x20, offvalue=0x00)
b31_6 = ttk.Checkbutton(content, command=run31, text="6", variable=b31_6var, onvalue=0x40, offvalue=0x00)
b31_7 = ttk.Checkbutton(content, command=run31, text="7", variable=b31_7var, onvalue=0x00, offvalue=0x00)

content.grid(column=0, row=0)

# Placing text above each byte
nameb28_0.grid(column=4, row=41, columnspan=2)
nameb29_0.grid(column=12, row=41, columnspan=2)
nameb30_0.grid(column=20, row=41, columnspan=2)
nameb31_0.grid(column=28, row=41, columnspan=2)

# Placing buttons on grid
b28_0.grid(column=8,row=42, ipadx=10)
b28_1.grid(column=7,row=42)
b28_2.grid(column=6,row=42)
b28_3.grid(column=5,row=42)
b28_4.grid(column=4,row=42)
b28_5.grid(column=3,row=42)
b28_6.grid(column=2,row=42)

b29_0.grid(column=16,row=42, ipadx=10)
b29_1.grid(column=15,row=42)
b29_2.grid(column=14,row=42)
b29_3.grid(column=13,row=42)
b29_4.grid(column=12,row=42)
b29_5.grid(column=11,row=42)
b29_6.grid(column=10,row=42)

b30_0.grid(column=24,row=42, ipadx=10)
b30_1.grid(column=23,row=42)
b30_2.grid(column=22,row=42)
b30_3.grid(column=21,row=42)
b30_4.grid(column=20,row=42)
b30_5.grid(column=19,row=42)
b30_6.grid(column=18,row=42)

b31_0.grid(column=32,row=42)
b31_1.grid(column=31,row=42)
b31_2.grid(column=30,row=42)
b31_3.grid(column=29,row=42)
b31_4.grid(column=28,row=42)
b31_5.grid(column=27,row=42)
b31_6.grid(column=26,row=42)

# Row 9 Draw

# defining labels
nameb32_0 = ttk.Label(content, text="Byte 32")
nameb33_0 = ttk.Label(content, text="Byte 33")
nameb34_0 = ttk.Label(content, text="Byte 34")
nameb35_0 = ttk.Label(content, text="Byte 35")


# Defining number type
b32_0var = IntVar()
b32_1var = IntVar()
b32_2var = IntVar()
b32_3var = IntVar()
b32_4var = IntVar()
b32_5var = IntVar()
b32_6var = IntVar()
b32_7var = IntVar()

b33_0var = IntVar()
b33_1var = IntVar()
b33_2var = IntVar()
b33_3var = IntVar()
b33_4var = IntVar()
b33_5var = IntVar()
b33_6var = IntVar()
b33_7var = IntVar()

b34_0var = IntVar()
b34_1var = IntVar()
b34_2var = IntVar()
b34_3var = IntVar()
b34_4var = IntVar()
b34_5var = IntVar()
b34_6var = IntVar()
b34_7var = IntVar()

b35_0var = IntVar()
b35_1var = IntVar()
b35_2var = IntVar()
b35_3var = IntVar()
b35_4var = IntVar()
b35_5var = IntVar()
b35_6var = IntVar()
b35_7var = IntVar()

# Setting default button position
b32_0var.set(0)
b32_1var.set(0)
b32_2var.set(0)
b32_3var.set(0)
b32_4var.set(0)
b32_5var.set(0)
b32_6var.set(0)
b32_7var.set(0)

b33_0var.set(0)
b33_1var.set(0)
b33_2var.set(0)
b33_3var.set(0)
b33_4var.set(0)
b33_5var.set(0)
b33_6var.set(0)
b33_7var.set(0)

b34_0var.set(0)
b34_1var.set(0)
b34_2var.set(0)
b34_3var.set(0)
b34_4var.set(0)
b34_5var.set(0)
b34_6var.set(0)
b34_7var.set(0)

b35_0var.set(0)
b35_1var.set(0)
b35_2var.set(0)
b35_3var.set(0)
b35_4var.set(0)
b35_5var.set(0)
b35_6var.set(0)
b35_7var.set(0)

# Defining button
b32_0 = ttk.Checkbutton(content, command=run32, text="0", variable=b32_0var, onvalue=0x01, offvalue=0x00)
b32_1 = ttk.Checkbutton(content, command=run32, text="1", variable=b32_1var, onvalue=0x02, offvalue=0x00)
b32_2 = ttk.Checkbutton(content, command=run32, text="2", variable=b32_2var, onvalue=0x04, offvalue=0x00)
b32_3 = ttk.Checkbutton(content, command=run32, text="3", variable=b32_3var, onvalue=0x08, offvalue=0x00)
b32_4 = ttk.Checkbutton(content, command=run32, text="4", variable=b32_4var, onvalue=0x10, offvalue=0x00)
b32_5 = ttk.Checkbutton(content, command=run32, text="5", variable=b32_5var, onvalue=0x20, offvalue=0x00)
b32_6 = ttk.Checkbutton(content, command=run32, text="6", variable=b32_6var, onvalue=0x40, offvalue=0x00)
b32_7 = ttk.Checkbutton(content, command=run32, text="7", variable=b32_7var, onvalue=0x00, offvalue=0x00)

b33_0 = ttk.Checkbutton(content, command=run33, text="0", variable=b33_0var, onvalue=0x01, offvalue=0x00)
b33_1 = ttk.Checkbutton(content, command=run33, text="1", variable=b33_1var, onvalue=0x02, offvalue=0x00)
b33_2 = ttk.Checkbutton(content, command=run33, text="2", variable=b33_2var, onvalue=0x04, offvalue=0x00)
b33_3 = ttk.Checkbutton(content, command=run33, text="3", variable=b33_3var, onvalue=0x08, offvalue=0x00)
b33_4 = ttk.Checkbutton(content, command=run33, text="4", variable=b33_4var, onvalue=0x10, offvalue=0x00)
b33_5 = ttk.Checkbutton(content, command=run33, text="5", variable=b33_5var, onvalue=0x20, offvalue=0x00)
b33_6 = ttk.Checkbutton(content, command=run33, text="6", variable=b33_6var, onvalue=0x40, offvalue=0x00)
b33_7 = ttk.Checkbutton(content, command=run33, text="7", variable=b33_7var, onvalue=0x00, offvalue=0x00)

b34_0 = ttk.Checkbutton(content, command=run34, text="0", variable=b34_0var, onvalue=0x01, offvalue=0x00)
b34_1 = ttk.Checkbutton(content, command=run34, text="1", variable=b34_1var, onvalue=0x02, offvalue=0x00)
b34_2 = ttk.Checkbutton(content, command=run34, text="2", variable=b34_2var, onvalue=0x04, offvalue=0x00)
b34_3 = ttk.Checkbutton(content, command=run34, text="3", variable=b34_3var, onvalue=0x08, offvalue=0x00)
b34_4 = ttk.Checkbutton(content, command=run34, text="4", variable=b34_4var, onvalue=0x10, offvalue=0x00)
b34_5 = ttk.Checkbutton(content, command=run34, text="5", variable=b34_5var, onvalue=0x20, offvalue=0x00)
b34_6 = ttk.Checkbutton(content, command=run34, text="6", variable=b34_6var, onvalue=0x40, offvalue=0x00)
b34_7 = ttk.Checkbutton(content, command=run34, text="7", variable=b34_7var, onvalue=0x00, offvalue=0x00)

b35_0 = ttk.Checkbutton(content, command=run35, text="0", variable=b35_0var, onvalue=0x01, offvalue=0x00)
b35_1 = ttk.Checkbutton(content, command=run35, text="1", variable=b35_1var, onvalue=0x02, offvalue=0x00)
b35_2 = ttk.Checkbutton(content, command=run35, text="2", variable=b35_2var, onvalue=0x04, offvalue=0x00)
b35_3 = ttk.Checkbutton(content, command=run35, text="3", variable=b35_3var, onvalue=0x08, offvalue=0x00)
b35_4 = ttk.Checkbutton(content, command=run35, text="4", variable=b35_4var, onvalue=0x10, offvalue=0x00)
b35_5 = ttk.Checkbutton(content, command=run35, text="5", variable=b35_5var, onvalue=0x20, offvalue=0x00)
b35_6 = ttk.Checkbutton(content, command=run35, text="6", variable=b35_6var, onvalue=0x40, offvalue=0x00)
b35_7 = ttk.Checkbutton(content, command=run35, text="7", variable=b35_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb32_0.grid(column=4, row=47, columnspan=2)
nameb33_0.grid(column=12, row=47, columnspan=2)
nameb34_0.grid(column=20, row=47, columnspan=2)
nameb35_0.grid(column=28, row=47, columnspan=2)

# Placing buttons on grid
b32_0.grid(column=8,row=48, ipadx=10)
b32_1.grid(column=7,row=48)
b32_2.grid(column=6,row=48)
b32_3.grid(column=5,row=48)
b32_4.grid(column=4,row=48)
b32_5.grid(column=3,row=48)
b32_6.grid(column=2,row=48)

b33_0.grid(column=16,row=48, ipadx=10)
b33_1.grid(column=15,row=48)
b33_2.grid(column=14,row=48)
b33_3.grid(column=13,row=48)
b33_4.grid(column=12,row=48)
b33_5.grid(column=11,row=48)
b33_6.grid(column=10,row=48)

b34_0.grid(column=24,row=48, ipadx=10)
b34_1.grid(column=23,row=48)
b34_2.grid(column=22,row=48)
b34_3.grid(column=21,row=48)
b34_4.grid(column=20,row=48)
b34_5.grid(column=19,row=48)
b34_6.grid(column=18,row=48)

b35_0.grid(column=32,row=48)
b35_1.grid(column=31,row=48)
b35_2.grid(column=30,row=48)
b35_3.grid(column=29,row=48)
b35_4.grid(column=28,row=48)
b35_5.grid(column=27,row=48)
b35_6.grid(column=26,row=48)


# Row 10 Draw

# defining labels
nameb36_0 = ttk.Label(content, text="Byte 36")
nameb37_0 = ttk.Label(content, text="Byte 37")
nameb38_0 = ttk.Label(content, text="Byte 38")
nameb39_0 = ttk.Label(content, text="Byte 39")


# Defining number type
b36_0var = IntVar()
b36_1var = IntVar()
b36_2var = IntVar()
b36_3var = IntVar()
b36_4var = IntVar()
b36_5var = IntVar()
b36_6var = IntVar()
b36_7var = IntVar()

b37_0var = IntVar()
b37_1var = IntVar()
b37_2var = IntVar()
b37_3var = IntVar()
b37_4var = IntVar()
b37_5var = IntVar()
b37_6var = IntVar()
b37_7var = IntVar()

b38_0var = IntVar()
b38_1var = IntVar()
b38_2var = IntVar()
b38_3var = IntVar()
b38_4var = IntVar()
b38_5var = IntVar()
b38_6var = IntVar()
b38_7var = IntVar()

b39_0var = IntVar()
b39_1var = IntVar()
b39_2var = IntVar()
b39_3var = IntVar()
b39_4var = IntVar()
b39_5var = IntVar()
b39_6var = IntVar()
b39_7var = IntVar()

# Setting default button position
b36_0var.set(0)
b36_1var.set(0)
b36_2var.set(0)
b36_3var.set(0)
b36_4var.set(0)
b36_5var.set(0)
b36_6var.set(0)
b36_7var.set(0)

b37_0var.set(0)
b37_1var.set(0)
b37_2var.set(0)
b37_3var.set(0)
b37_4var.set(0)
b37_5var.set(0)
b37_6var.set(0)
b37_7var.set(0)

b38_0var.set(0)
b38_1var.set(0)
b38_2var.set(0)
b38_3var.set(0)
b38_4var.set(0)
b38_5var.set(0)
b38_6var.set(0)
b38_7var.set(0)

b39_0var.set(0)
b39_1var.set(0)
b39_2var.set(0)
b39_3var.set(0)
b39_4var.set(0)
b39_5var.set(0)
b39_6var.set(0)
b39_7var.set(0)

# Defining button
b36_0 = ttk.Checkbutton(content, command=run36, text="0", variable=b36_0var, onvalue=0x01, offvalue=0x00)
b36_1 = ttk.Checkbutton(content, command=run36, text="1", variable=b36_1var, onvalue=0x02, offvalue=0x00)
b36_2 = ttk.Checkbutton(content, command=run36, text="2", variable=b36_2var, onvalue=0x04, offvalue=0x00)
b36_3 = ttk.Checkbutton(content, command=run36, text="3", variable=b36_3var, onvalue=0x08, offvalue=0x00)
b36_4 = ttk.Checkbutton(content, command=run36, text="4", variable=b36_4var, onvalue=0x10, offvalue=0x00)
b36_5 = ttk.Checkbutton(content, command=run36, text="5", variable=b36_5var, onvalue=0x20, offvalue=0x00)
b36_6 = ttk.Checkbutton(content, command=run36, text="6", variable=b36_6var, onvalue=0x40, offvalue=0x00)
b36_7 = ttk.Checkbutton(content, command=run36, text="7", variable=b36_7var, onvalue=0x00, offvalue=0x00)

b37_0 = ttk.Checkbutton(content, command=run37, text="0", variable=b37_0var, onvalue=0x01, offvalue=0x00)
b37_1 = ttk.Checkbutton(content, command=run37, text="1", variable=b37_1var, onvalue=0x02, offvalue=0x00)
b37_2 = ttk.Checkbutton(content, command=run37, text="2", variable=b37_2var, onvalue=0x04, offvalue=0x00)
b37_3 = ttk.Checkbutton(content, command=run37, text="3", variable=b37_3var, onvalue=0x08, offvalue=0x00)
b37_4 = ttk.Checkbutton(content, command=run37, text="4", variable=b37_4var, onvalue=0x10, offvalue=0x00)
b37_5 = ttk.Checkbutton(content, command=run37, text="5", variable=b37_5var, onvalue=0x20, offvalue=0x00)
b37_6 = ttk.Checkbutton(content, command=run37, text="6", variable=b37_6var, onvalue=0x40, offvalue=0x00)
b37_7 = ttk.Checkbutton(content, command=run37, text="7", variable=b37_7var, onvalue=0x00, offvalue=0x00)

b38_0 = ttk.Checkbutton(content, command=run38, text="0", variable=b38_0var, onvalue=0x01, offvalue=0x00)
b38_1 = ttk.Checkbutton(content, command=run38, text="1", variable=b38_1var, onvalue=0x02, offvalue=0x00)
b38_2 = ttk.Checkbutton(content, command=run38, text="2", variable=b38_2var, onvalue=0x04, offvalue=0x00)
b38_3 = ttk.Checkbutton(content, command=run38, text="3", variable=b38_3var, onvalue=0x08, offvalue=0x00)
b38_4 = ttk.Checkbutton(content, command=run38, text="4", variable=b38_4var, onvalue=0x10, offvalue=0x00)
b38_5 = ttk.Checkbutton(content, command=run38, text="5", variable=b38_5var, onvalue=0x20, offvalue=0x00)
b38_6 = ttk.Checkbutton(content, command=run38, text="6", variable=b38_6var, onvalue=0x40, offvalue=0x00)
b38_7 = ttk.Checkbutton(content, command=run38, text="7", variable=b38_7var, onvalue=0x00, offvalue=0x00)

b39_0 = ttk.Checkbutton(content, command=run39, text="0", variable=b39_0var, onvalue=0x01, offvalue=0x00)
b39_1 = ttk.Checkbutton(content, command=run39, text="1", variable=b39_1var, onvalue=0x02, offvalue=0x00)
b39_2 = ttk.Checkbutton(content, command=run39, text="2", variable=b39_2var, onvalue=0x04, offvalue=0x00)
b39_3 = ttk.Checkbutton(content, command=run39, text="3", variable=b39_3var, onvalue=0x08, offvalue=0x00)
b39_4 = ttk.Checkbutton(content, command=run39, text="4", variable=b39_4var, onvalue=0x10, offvalue=0x00)
b39_5 = ttk.Checkbutton(content, command=run39, text="5", variable=b39_5var, onvalue=0x20, offvalue=0x00)
b39_6 = ttk.Checkbutton(content, command=run39, text="6", variable=b39_6var, onvalue=0x40, offvalue=0x00)
b39_7 = ttk.Checkbutton(content, command=run39, text="7", variable=b39_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb36_0.grid(column=4, row=53, columnspan=2)
nameb37_0.grid(column=12, row=53, columnspan=2)
nameb38_0.grid(column=20, row=53, columnspan=2)
nameb39_0.grid(column=28, row=53, columnspan=2)

# Placing buttons on grid
b36_0.grid(column=8,row=54, ipadx=10)
b36_1.grid(column=7,row=54)
b36_2.grid(column=6,row=54)
b36_3.grid(column=5,row=54)
b36_4.grid(column=4,row=54)
b36_5.grid(column=3,row=54)
b36_6.grid(column=2,row=54)

b37_0.grid(column=16,row=54, ipadx=10)
b37_1.grid(column=15,row=54)
b37_2.grid(column=14,row=54)
b37_3.grid(column=13,row=54)
b37_4.grid(column=12,row=54)
b37_5.grid(column=11,row=54)
b37_6.grid(column=10,row=54)

b38_0.grid(column=24,row=54, ipadx=10)
b38_1.grid(column=23,row=54)
b38_2.grid(column=22,row=54)
b38_3.grid(column=21,row=54)
b38_4.grid(column=20,row=54)
b38_5.grid(column=19,row=54)
b38_6.grid(column=18,row=54)

b39_0.grid(column=32,row=54)
b39_1.grid(column=31,row=54)
b39_2.grid(column=30,row=54)
b39_3.grid(column=29,row=54)
b39_4.grid(column=28,row=54)
b39_5.grid(column=27,row=54)
b39_6.grid(column=26,row=54)


# Row 11 Draw

# defining labels
nameb40_0 = ttk.Label(content, text="Byte 40")
nameb41_0 = ttk.Label(content, text="Byte 41")
nameb42_0 = ttk.Label(content, text="Byte 42")
nameb43_0 = ttk.Label(content, text="Byte 43")


# Defining number type
b40_0var = IntVar()
b40_1var = IntVar()
b40_2var = IntVar()
b40_3var = IntVar()
b40_4var = IntVar()
b40_5var = IntVar()
b40_6var = IntVar()
b40_7var = IntVar()

b41_0var = IntVar()
b41_1var = IntVar()
b41_2var = IntVar()
b41_3var = IntVar()
b41_4var = IntVar()
b41_5var = IntVar()
b41_6var = IntVar()
b41_7var = IntVar()

b42_0var = IntVar()
b42_1var = IntVar()
b42_2var = IntVar()
b42_3var = IntVar()
b42_4var = IntVar()
b42_5var = IntVar()
b42_6var = IntVar()
b42_7var = IntVar()

b43_0var = IntVar()
b43_1var = IntVar()
b43_2var = IntVar()
b43_3var = IntVar()
b43_4var = IntVar()
b43_5var = IntVar()
b43_6var = IntVar()
b43_7var = IntVar()

# Setting default button position
b40_0var.set(0)
b40_1var.set(0)
b40_2var.set(0)
b40_3var.set(0)
b40_4var.set(0)
b40_5var.set(0)
b40_6var.set(0)
b40_7var.set(0)

b41_0var.set(0)
b41_1var.set(0)
b41_2var.set(0)
b41_3var.set(0)
b41_4var.set(0)
b41_5var.set(0)
b41_6var.set(0)
b41_7var.set(0)

b42_0var.set(0)
b42_1var.set(0)
b42_2var.set(0)
b42_3var.set(0)
b42_4var.set(0)
b42_5var.set(0)
b42_6var.set(0)
b42_7var.set(0)

b43_0var.set(0)
b43_1var.set(0)
b43_2var.set(0)
b43_3var.set(0)
b43_4var.set(0)
b43_5var.set(0)
b43_6var.set(0)
b43_7var.set(0)

# Defining button
b40_0 = ttk.Checkbutton(content, command=run40, text="0", variable=b40_0var, onvalue=0x01, offvalue=0x00)
b40_1 = ttk.Checkbutton(content, command=run40, text="1", variable=b40_1var, onvalue=0x02, offvalue=0x00)
b40_2 = ttk.Checkbutton(content, command=run40, text="2", variable=b40_2var, onvalue=0x04, offvalue=0x00)
b40_3 = ttk.Checkbutton(content, command=run40, text="3", variable=b40_3var, onvalue=0x08, offvalue=0x00)
b40_4 = ttk.Checkbutton(content, command=run40, text="4", variable=b40_4var, onvalue=0x10, offvalue=0x00)
b40_5 = ttk.Checkbutton(content, command=run40, text="5", variable=b40_5var, onvalue=0x20, offvalue=0x00)
b40_6 = ttk.Checkbutton(content, command=run40, text="6", variable=b40_6var, onvalue=0x40, offvalue=0x00)
b40_7 = ttk.Checkbutton(content, command=run40, text="7", variable=b40_7var, onvalue=0x00, offvalue=0x00)

b41_0 = ttk.Checkbutton(content, command=run41, text="0", variable=b41_0var, onvalue=0x01, offvalue=0x00)
b41_1 = ttk.Checkbutton(content, command=run41, text="1", variable=b41_1var, onvalue=0x02, offvalue=0x00)
b41_2 = ttk.Checkbutton(content, command=run41, text="2", variable=b41_2var, onvalue=0x04, offvalue=0x00)
b41_3 = ttk.Checkbutton(content, command=run41, text="3", variable=b41_3var, onvalue=0x08, offvalue=0x00)
b41_4 = ttk.Checkbutton(content, command=run41, text="4", variable=b41_4var, onvalue=0x10, offvalue=0x00)
b41_5 = ttk.Checkbutton(content, command=run41, text="5", variable=b41_5var, onvalue=0x20, offvalue=0x00)
b41_6 = ttk.Checkbutton(content, command=run41, text="6", variable=b41_6var, onvalue=0x40, offvalue=0x00)
b41_7 = ttk.Checkbutton(content, command=run41, text="7", variable=b41_7var, onvalue=0x00, offvalue=0x00)

b42_0 = ttk.Checkbutton(content, command=run42, text="0", variable=b42_0var, onvalue=0x01, offvalue=0x00)
b42_1 = ttk.Checkbutton(content, command=run42, text="1", variable=b42_1var, onvalue=0x02, offvalue=0x00)
b42_2 = ttk.Checkbutton(content, command=run42, text="2", variable=b42_2var, onvalue=0x04, offvalue=0x00)
b42_3 = ttk.Checkbutton(content, command=run42, text="3", variable=b42_3var, onvalue=0x08, offvalue=0x00)
b42_4 = ttk.Checkbutton(content, command=run42, text="4", variable=b42_4var, onvalue=0x10, offvalue=0x00)
b42_5 = ttk.Checkbutton(content, command=run42, text="5", variable=b42_5var, onvalue=0x20, offvalue=0x00)
b42_6 = ttk.Checkbutton(content, command=run42, text="6", variable=b42_6var, onvalue=0x40, offvalue=0x00)
b42_7 = ttk.Checkbutton(content, command=run42, text="7", variable=b42_7var, onvalue=0x00, offvalue=0x00)

b43_0 = ttk.Checkbutton(content, command=run43, text="0", variable=b43_0var, onvalue=0x01, offvalue=0x00)
b43_1 = ttk.Checkbutton(content, command=run43, text="1", variable=b43_1var, onvalue=0x02, offvalue=0x00)
b43_2 = ttk.Checkbutton(content, command=run43, text="2", variable=b43_2var, onvalue=0x04, offvalue=0x00)
b43_3 = ttk.Checkbutton(content, command=run43, text="3", variable=b43_3var, onvalue=0x08, offvalue=0x00)
b43_4 = ttk.Checkbutton(content, command=run43, text="4", variable=b43_4var, onvalue=0x10, offvalue=0x00)
b43_5 = ttk.Checkbutton(content, command=run43, text="5", variable=b43_5var, onvalue=0x20, offvalue=0x00)
b43_6 = ttk.Checkbutton(content, command=run43, text="6", variable=b43_6var, onvalue=0x40, offvalue=0x00)
b43_7 = ttk.Checkbutton(content, command=run43, text="7", variable=b43_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb40_0.grid(column=4, row=59, columnspan=2)
nameb41_0.grid(column=12, row=59, columnspan=2)
nameb42_0.grid(column=20, row=59, columnspan=2)
nameb43_0.grid(column=28, row=59, columnspan=2)

# Placing buttons on grid
b40_0.grid(column=8,row=60, ipadx=10)
b40_1.grid(column=7,row=60)
b40_2.grid(column=6,row=60)
b40_3.grid(column=5,row=60)
b40_4.grid(column=4,row=60)
b40_5.grid(column=3,row=60)
b40_6.grid(column=2,row=60)

b41_0.grid(column=16,row=60, ipadx=10)
b41_1.grid(column=15,row=60)
b41_2.grid(column=14,row=60)
b41_3.grid(column=13,row=60)
b41_4.grid(column=12,row=60)
b41_5.grid(column=11,row=60)
b41_6.grid(column=10,row=60)

b42_0.grid(column=24,row=60, ipadx=10)
b42_1.grid(column=23,row=60)
b42_2.grid(column=22,row=60)
b42_3.grid(column=21,row=60)
b42_4.grid(column=20,row=60)
b42_5.grid(column=19,row=60)
b42_6.grid(column=18,row=60)

b43_0.grid(column=32,row=60)
b43_1.grid(column=31,row=60)
b43_2.grid(column=30,row=60)
b43_3.grid(column=29,row=60)
b43_4.grid(column=28,row=60)
b43_5.grid(column=27,row=60)
b43_6.grid(column=26,row=60)


# Row 12 Draw

# defining labels
nameb44_0 = ttk.Label(content, text="Byte 44")
nameb45_0 = ttk.Label(content, text="Byte 45")
nameb46_0 = ttk.Label(content, text="Byte 46")
nameb47_0 = ttk.Label(content, text="Byte 47")


# Defining number type
b44_0var = IntVar()
b44_1var = IntVar()
b44_2var = IntVar()
b44_3var = IntVar()
b44_4var = IntVar()
b44_5var = IntVar()
b44_6var = IntVar()
b44_7var = IntVar()

b45_0var = IntVar()
b45_1var = IntVar()
b45_2var = IntVar()
b45_3var = IntVar()
b45_4var = IntVar()
b45_5var = IntVar()
b45_6var = IntVar()
b45_7var = IntVar()

b46_0var = IntVar()
b46_1var = IntVar()
b46_2var = IntVar()
b46_3var = IntVar()
b46_4var = IntVar()
b46_5var = IntVar()
b46_6var = IntVar()
b46_7var = IntVar()

b47_0var = IntVar()
b47_1var = IntVar()
b47_2var = IntVar()
b47_3var = IntVar()
b47_4var = IntVar()
b47_5var = IntVar()
b47_6var = IntVar()
b47_7var = IntVar()

# Setting default button position
b44_0var.set(0)
b44_1var.set(0)
b44_2var.set(0)
b44_3var.set(0)
b44_4var.set(0)
b44_5var.set(0)
b44_6var.set(0)
b44_7var.set(0)

b45_0var.set(0)
b45_1var.set(0)
b45_2var.set(0)
b45_3var.set(0)
b45_4var.set(0)
b45_5var.set(0)
b45_6var.set(0)
b45_7var.set(0)

b46_0var.set(0)
b46_1var.set(0)
b46_2var.set(0)
b46_3var.set(0)
b46_4var.set(0)
b46_5var.set(0)
b46_6var.set(0)
b46_7var.set(0)

b47_0var.set(0)
b47_1var.set(0)
b47_2var.set(0)
b47_3var.set(0)
b47_4var.set(0)
b47_5var.set(0)
b47_6var.set(0)
b47_7var.set(0)

# Defining button
b44_0 = ttk.Checkbutton(content, command=run44, text="0", variable=b44_0var, onvalue=0x01, offvalue=0x00)
b44_1 = ttk.Checkbutton(content, command=run44, text="1", variable=b44_1var, onvalue=0x02, offvalue=0x00)
b44_2 = ttk.Checkbutton(content, command=run44, text="2", variable=b44_2var, onvalue=0x04, offvalue=0x00)
b44_3 = ttk.Checkbutton(content, command=run44, text="3", variable=b44_3var, onvalue=0x08, offvalue=0x00)
b44_4 = ttk.Checkbutton(content, command=run44, text="4", variable=b44_4var, onvalue=0x10, offvalue=0x00)
b44_5 = ttk.Checkbutton(content, command=run44, text="5", variable=b44_5var, onvalue=0x20, offvalue=0x00)
b44_6 = ttk.Checkbutton(content, command=run44, text="6", variable=b44_6var, onvalue=0x40, offvalue=0x00)
b44_7 = ttk.Checkbutton(content, command=run44, text="7", variable=b44_7var, onvalue=0x00, offvalue=0x00)

b45_0 = ttk.Checkbutton(content, command=run45, text="0", variable=b45_0var, onvalue=0x01, offvalue=0x00)
b45_1 = ttk.Checkbutton(content, command=run45, text="1", variable=b45_1var, onvalue=0x02, offvalue=0x00)
b45_2 = ttk.Checkbutton(content, command=run45, text="2", variable=b45_2var, onvalue=0x04, offvalue=0x00)
b45_3 = ttk.Checkbutton(content, command=run45, text="3", variable=b45_3var, onvalue=0x08, offvalue=0x00)
b45_4 = ttk.Checkbutton(content, command=run45, text="4", variable=b45_4var, onvalue=0x10, offvalue=0x00)
b45_5 = ttk.Checkbutton(content, command=run45, text="5", variable=b45_5var, onvalue=0x20, offvalue=0x00)
b45_6 = ttk.Checkbutton(content, command=run45, text="6", variable=b45_6var, onvalue=0x40, offvalue=0x00)
b45_7 = ttk.Checkbutton(content, command=run45, text="7", variable=b45_7var, onvalue=0x00, offvalue=0x00)

b46_0 = ttk.Checkbutton(content, command=run46, text="0", variable=b46_0var, onvalue=0x01, offvalue=0x00)
b46_1 = ttk.Checkbutton(content, command=run46, text="1", variable=b46_1var, onvalue=0x02, offvalue=0x00)
b46_2 = ttk.Checkbutton(content, command=run46, text="2", variable=b46_2var, onvalue=0x04, offvalue=0x00)
b46_3 = ttk.Checkbutton(content, command=run46, text="3", variable=b46_3var, onvalue=0x08, offvalue=0x00)
b46_4 = ttk.Checkbutton(content, command=run46, text="4", variable=b46_4var, onvalue=0x10, offvalue=0x00)
b46_5 = ttk.Checkbutton(content, command=run46, text="5", variable=b46_5var, onvalue=0x20, offvalue=0x00)
b46_6 = ttk.Checkbutton(content, command=run46, text="6", variable=b46_6var, onvalue=0x40, offvalue=0x00)
b46_7 = ttk.Checkbutton(content, command=run46, text="7", variable=b46_7var, onvalue=0x00, offvalue=0x00)

b47_0 = ttk.Checkbutton(content, command=run47, text="0", variable=b47_0var, onvalue=0x01, offvalue=0x00)
b47_1 = ttk.Checkbutton(content, command=run47, text="1", variable=b47_1var, onvalue=0x02, offvalue=0x00)
b47_2 = ttk.Checkbutton(content, command=run47, text="2", variable=b47_2var, onvalue=0x04, offvalue=0x00)
b47_3 = ttk.Checkbutton(content, command=run47, text="3", variable=b47_3var, onvalue=0x08, offvalue=0x00)
b47_4 = ttk.Checkbutton(content, command=run47, text="4", variable=b47_4var, onvalue=0x10, offvalue=0x00)
b47_5 = ttk.Checkbutton(content, command=run47, text="5", variable=b47_5var, onvalue=0x20, offvalue=0x00)
b47_6 = ttk.Checkbutton(content, command=run47, text="6", variable=b47_6var, onvalue=0x40, offvalue=0x00)
b47_7 = ttk.Checkbutton(content, command=run47, text="7", variable=b47_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb44_0.grid(column=4, row=65, columnspan=2)
nameb45_0.grid(column=12, row=65, columnspan=2)
nameb46_0.grid(column=20, row=65, columnspan=2)
nameb47_0.grid(column=28, row=65, columnspan=2)

# Placing buttons on grid
b44_0.grid(column=8,row=66, ipadx=10)
b44_1.grid(column=7,row=66)
b44_2.grid(column=6,row=66)
b44_3.grid(column=5,row=66)
b44_4.grid(column=4,row=66)
b44_5.grid(column=3,row=66)
b44_6.grid(column=2,row=66)

b45_0.grid(column=16,row=66, ipadx=10)
b45_1.grid(column=15,row=66)
b45_2.grid(column=14,row=66)
b45_3.grid(column=13,row=66)
b45_4.grid(column=12,row=66)
b45_5.grid(column=11,row=66)
b45_6.grid(column=10,row=66)

b46_0.grid(column=24,row=66, ipadx=10)
b46_1.grid(column=23,row=66)
b46_2.grid(column=22,row=66)
b46_3.grid(column=21,row=66)
b46_4.grid(column=20,row=66)
b46_5.grid(column=19,row=66)
b46_6.grid(column=18,row=66)

b47_0.grid(column=32,row=66)
b47_1.grid(column=31,row=66)
b47_2.grid(column=30,row=66)
b47_3.grid(column=29,row=66)
b47_4.grid(column=28,row=66)
b47_5.grid(column=27,row=66)
b47_6.grid(column=26,row=66)


# Row 13 Draw

# defining labels
nameb48_0 = ttk.Label(content, text="Byte 48")
nameb49_0 = ttk.Label(content, text="Byte 49")
nameb50_0 = ttk.Label(content, text="Byte 50")
nameb51_0 = ttk.Label(content, text="Byte 51")


# Defining number type
b48_0var = IntVar()
b48_1var = IntVar()
b48_2var = IntVar()
b48_3var = IntVar()
b48_4var = IntVar()
b48_5var = IntVar()
b48_6var = IntVar()
b48_7var = IntVar()

b49_0var = IntVar()
b49_1var = IntVar()
b49_2var = IntVar()
b49_3var = IntVar()
b49_4var = IntVar()
b49_5var = IntVar()
b49_6var = IntVar()
b49_7var = IntVar()

b50_0var = IntVar()
b50_1var = IntVar()
b50_2var = IntVar()
b50_3var = IntVar()
b50_4var = IntVar()
b50_5var = IntVar()
b50_6var = IntVar()
b50_7var = IntVar()

b51_0var = IntVar()
b51_1var = IntVar()
b51_2var = IntVar()
b51_3var = IntVar()
b51_4var = IntVar()
b51_5var = IntVar()
b51_6var = IntVar()
b51_7var = IntVar()

# Setting default button position
b48_0var.set(0)
b48_1var.set(0)
b48_2var.set(0)
b48_3var.set(0)
b48_4var.set(0)
b48_5var.set(0)
b48_6var.set(0)
b48_7var.set(0)

b49_0var.set(0)
b49_1var.set(0)
b49_2var.set(0)
b49_3var.set(0)
b49_4var.set(0)
b49_5var.set(0)
b49_6var.set(0)
b49_7var.set(0)

b50_0var.set(0)
b50_1var.set(0)
b50_2var.set(0)
b50_3var.set(0)
b50_4var.set(0)
b50_5var.set(0)
b50_6var.set(0)
b50_7var.set(0)

b51_0var.set(0)
b51_1var.set(0)
b51_2var.set(0)
b51_3var.set(0)
b51_4var.set(0)
b51_5var.set(0)
b51_6var.set(0)
b51_7var.set(0)

# Defining button
b48_0 = ttk.Checkbutton(content, command=run48, text="0", variable=b48_0var, onvalue=0x01, offvalue=0x00)
b48_1 = ttk.Checkbutton(content, command=run48, text="1", variable=b48_1var, onvalue=0x02, offvalue=0x00)
b48_2 = ttk.Checkbutton(content, command=run48, text="2", variable=b48_2var, onvalue=0x04, offvalue=0x00)
b48_3 = ttk.Checkbutton(content, command=run48, text="3", variable=b48_3var, onvalue=0x08, offvalue=0x00)
b48_4 = ttk.Checkbutton(content, command=run48, text="4", variable=b48_4var, onvalue=0x10, offvalue=0x00)
b48_5 = ttk.Checkbutton(content, command=run48, text="5", variable=b48_5var, onvalue=0x20, offvalue=0x00)
b48_6 = ttk.Checkbutton(content, command=run48, text="6", variable=b48_6var, onvalue=0x40, offvalue=0x00)
b48_7 = ttk.Checkbutton(content, command=run48, text="7", variable=b48_7var, onvalue=0x00, offvalue=0x00)

b49_0 = ttk.Checkbutton(content, command=run49, text="0", variable=b49_0var, onvalue=0x01, offvalue=0x00)
b49_1 = ttk.Checkbutton(content, command=run49, text="1", variable=b49_1var, onvalue=0x02, offvalue=0x00)
b49_2 = ttk.Checkbutton(content, command=run49, text="2", variable=b49_2var, onvalue=0x04, offvalue=0x00)
b49_3 = ttk.Checkbutton(content, command=run49, text="3", variable=b49_3var, onvalue=0x08, offvalue=0x00)
b49_4 = ttk.Checkbutton(content, command=run49, text="4", variable=b49_4var, onvalue=0x10, offvalue=0x00)
b49_5 = ttk.Checkbutton(content, command=run49, text="5", variable=b49_5var, onvalue=0x20, offvalue=0x00)
b49_6 = ttk.Checkbutton(content, command=run49, text="6", variable=b49_6var, onvalue=0x40, offvalue=0x00)
b49_7 = ttk.Checkbutton(content, command=run49, text="7", variable=b49_7var, onvalue=0x00, offvalue=0x00)

b50_0 = ttk.Checkbutton(content, command=run50, text="0", variable=b50_0var, onvalue=0x01, offvalue=0x00)
b50_1 = ttk.Checkbutton(content, command=run50, text="1", variable=b50_1var, onvalue=0x02, offvalue=0x00)
b50_2 = ttk.Checkbutton(content, command=run50, text="2", variable=b50_2var, onvalue=0x04, offvalue=0x00)
b50_3 = ttk.Checkbutton(content, command=run50, text="3", variable=b50_3var, onvalue=0x08, offvalue=0x00)
b50_4 = ttk.Checkbutton(content, command=run50, text="4", variable=b50_4var, onvalue=0x10, offvalue=0x00)
b50_5 = ttk.Checkbutton(content, command=run50, text="5", variable=b50_5var, onvalue=0x20, offvalue=0x00)
b50_6 = ttk.Checkbutton(content, command=run50, text="6", variable=b50_6var, onvalue=0x40, offvalue=0x00)
b50_7 = ttk.Checkbutton(content, command=run50, text="7", variable=b50_7var, onvalue=0x00, offvalue=0x00)

b51_0 = ttk.Checkbutton(content, command=run51, text="0", variable=b51_0var, onvalue=0x01, offvalue=0x00)
b51_1 = ttk.Checkbutton(content, command=run51, text="1", variable=b51_1var, onvalue=0x02, offvalue=0x00)
b51_2 = ttk.Checkbutton(content, command=run51, text="2", variable=b51_2var, onvalue=0x04, offvalue=0x00)
b51_3 = ttk.Checkbutton(content, command=run51, text="3", variable=b51_3var, onvalue=0x08, offvalue=0x00)
b51_4 = ttk.Checkbutton(content, command=run51, text="4", variable=b51_4var, onvalue=0x10, offvalue=0x00)
b51_5 = ttk.Checkbutton(content, command=run51, text="5", variable=b51_5var, onvalue=0x20, offvalue=0x00)
b51_6 = ttk.Checkbutton(content, command=run51, text="6", variable=b51_6var, onvalue=0x40, offvalue=0x00)
b51_7 = ttk.Checkbutton(content, command=run51, text="7", variable=b51_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb48_0.grid(column=4, row=71, columnspan=2)
nameb49_0.grid(column=12, row=71, columnspan=2)
nameb50_0.grid(column=20, row=71, columnspan=2)
nameb51_0.grid(column=28, row=71, columnspan=2)

# Placing buttons on grid
b48_0.grid(column=8,row=72, ipadx=10)
b48_1.grid(column=7,row=72)
b48_2.grid(column=6,row=72)
b48_3.grid(column=5,row=72)
b48_4.grid(column=4,row=72)
b48_5.grid(column=3,row=72)
b48_6.grid(column=2,row=72)

b49_0.grid(column=16,row=72, ipadx=10)
b49_1.grid(column=15,row=72)
b49_2.grid(column=14,row=72)
b49_3.grid(column=13,row=72)
b49_4.grid(column=12,row=72)
b49_5.grid(column=11,row=72)
b49_6.grid(column=10,row=72)

b50_0.grid(column=24,row=72, ipadx=10)
b50_1.grid(column=23,row=72)
b50_2.grid(column=22,row=72)
b50_3.grid(column=21,row=72)
b50_4.grid(column=20,row=72)
b50_5.grid(column=19,row=72)
b50_6.grid(column=18,row=72)

b51_0.grid(column=32,row=72)
b51_1.grid(column=31,row=72)
b51_2.grid(column=30,row=72)
b51_3.grid(column=29,row=72)
b51_4.grid(column=28,row=72)
b51_5.grid(column=27,row=72)
b51_6.grid(column=26,row=72)


# Row 14 Draw

# defining labels
nameb52_0 = ttk.Label(content, text="Byte 52")
nameb53_0 = ttk.Label(content, text="Byte 53")
nameb54_0 = ttk.Label(content, text="Byte 54")
nameb55_0 = ttk.Label(content, text="Byte 55")


# Defining number type
b52_0var = IntVar()
b52_1var = IntVar()
b52_2var = IntVar()
b52_3var = IntVar()
b52_4var = IntVar()
b52_5var = IntVar()
b52_6var = IntVar()
b52_7var = IntVar()

b53_0var = IntVar()
b53_1var = IntVar()
b53_2var = IntVar()
b53_3var = IntVar()
b53_4var = IntVar()
b53_5var = IntVar()
b53_6var = IntVar()
b53_7var = IntVar()

b54_0var = IntVar()
b54_1var = IntVar()
b54_2var = IntVar()
b54_3var = IntVar()
b54_4var = IntVar()
b54_5var = IntVar()
b54_6var = IntVar()
b54_7var = IntVar()

b55_0var = IntVar()
b55_1var = IntVar()
b55_2var = IntVar()
b55_3var = IntVar()
b55_4var = IntVar()
b55_5var = IntVar()
b55_6var = IntVar()
b55_7var = IntVar()

# Setting default button position
b52_0var.set(0)
b52_1var.set(0)
b52_2var.set(0)
b52_3var.set(0)
b52_4var.set(0)
b52_5var.set(0)
b52_6var.set(0)
b52_7var.set(0)

b53_0var.set(0)
b53_1var.set(0)
b53_2var.set(0)
b53_3var.set(0)
b53_4var.set(0)
b53_5var.set(0)
b53_6var.set(0)
b53_7var.set(0)

b54_0var.set(0)
b54_1var.set(0)
b54_2var.set(0)
b54_3var.set(0)
b54_4var.set(0)
b54_5var.set(0)
b54_6var.set(0)
b54_7var.set(0)

b55_0var.set(0)
b55_1var.set(0)
b55_2var.set(0)
b55_3var.set(0)
b55_4var.set(0)
b55_5var.set(0)
b55_6var.set(0)
b55_7var.set(0)

# Defining button
b52_0 = ttk.Checkbutton(content, command=run52, text="0", variable=b52_0var, onvalue=0x01, offvalue=0x00)
b52_1 = ttk.Checkbutton(content, command=run52, text="1", variable=b52_1var, onvalue=0x02, offvalue=0x00)
b52_2 = ttk.Checkbutton(content, command=run52, text="2", variable=b52_2var, onvalue=0x04, offvalue=0x00)
b52_3 = ttk.Checkbutton(content, command=run52, text="3", variable=b52_3var, onvalue=0x08, offvalue=0x00)
b52_4 = ttk.Checkbutton(content, command=run52, text="4", variable=b52_4var, onvalue=0x10, offvalue=0x00)
b52_5 = ttk.Checkbutton(content, command=run52, text="5", variable=b52_5var, onvalue=0x20, offvalue=0x00)
b52_6 = ttk.Checkbutton(content, command=run52, text="6", variable=b52_6var, onvalue=0x40, offvalue=0x00)
b52_7 = ttk.Checkbutton(content, command=run52, text="7", variable=b52_7var, onvalue=0x00, offvalue=0x00)

b53_0 = ttk.Checkbutton(content, command=run53, text="0", variable=b53_0var, onvalue=0x01, offvalue=0x00)
b53_1 = ttk.Checkbutton(content, command=run53, text="1", variable=b53_1var, onvalue=0x02, offvalue=0x00)
b53_2 = ttk.Checkbutton(content, command=run53, text="2", variable=b53_2var, onvalue=0x04, offvalue=0x00)
b53_3 = ttk.Checkbutton(content, command=run53, text="3", variable=b53_3var, onvalue=0x08, offvalue=0x00)
b53_4 = ttk.Checkbutton(content, command=run53, text="4", variable=b53_4var, onvalue=0x10, offvalue=0x00)
b53_5 = ttk.Checkbutton(content, command=run53, text="5", variable=b53_5var, onvalue=0x20, offvalue=0x00)
b53_6 = ttk.Checkbutton(content, command=run53, text="6", variable=b53_6var, onvalue=0x40, offvalue=0x00)
b53_7 = ttk.Checkbutton(content, command=run53, text="7", variable=b53_7var, onvalue=0x00, offvalue=0x00)

b54_0 = ttk.Checkbutton(content, command=run54, text="0", variable=b54_0var, onvalue=0x01, offvalue=0x00)
b54_1 = ttk.Checkbutton(content, command=run54, text="1", variable=b54_1var, onvalue=0x02, offvalue=0x00)
b54_2 = ttk.Checkbutton(content, command=run54, text="2", variable=b54_2var, onvalue=0x04, offvalue=0x00)
b54_3 = ttk.Checkbutton(content, command=run54, text="3", variable=b54_3var, onvalue=0x08, offvalue=0x00)
b54_4 = ttk.Checkbutton(content, command=run54, text="4", variable=b54_4var, onvalue=0x10, offvalue=0x00)
b54_5 = ttk.Checkbutton(content, command=run54, text="5", variable=b54_5var, onvalue=0x20, offvalue=0x00)
b54_6 = ttk.Checkbutton(content, command=run54, text="6", variable=b54_6var, onvalue=0x40, offvalue=0x00)
b54_7 = ttk.Checkbutton(content, command=run54, text="7", variable=b54_7var, onvalue=0x00, offvalue=0x00)

b55_0 = ttk.Checkbutton(content, command=run55, text="0", variable=b55_0var, onvalue=0x01, offvalue=0x00)
b55_1 = ttk.Checkbutton(content, command=run55, text="1", variable=b55_1var, onvalue=0x02, offvalue=0x00)
b55_2 = ttk.Checkbutton(content, command=run55, text="2", variable=b55_2var, onvalue=0x04, offvalue=0x00)
b55_3 = ttk.Checkbutton(content, command=run55, text="3", variable=b55_3var, onvalue=0x08, offvalue=0x00)
b55_4 = ttk.Checkbutton(content, command=run55, text="4", variable=b55_4var, onvalue=0x10, offvalue=0x00)
b55_5 = ttk.Checkbutton(content, command=run55, text="5", variable=b55_5var, onvalue=0x20, offvalue=0x00)
b55_6 = ttk.Checkbutton(content, command=run55, text="6", variable=b55_6var, onvalue=0x40, offvalue=0x00)
b55_7 = ttk.Checkbutton(content, command=run55, text="7", variable=b55_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb52_0.grid(column=4, row=77, columnspan=2)
nameb53_0.grid(column=12, row=77, columnspan=2)
nameb54_0.grid(column=20, row=77, columnspan=2)
nameb55_0.grid(column=28, row=77, columnspan=2)

# Placing buttons on grid
b52_0.grid(column=8,row=78, ipadx=10)
b52_1.grid(column=7,row=78)
b52_2.grid(column=6,row=78)
b52_3.grid(column=5,row=78)
b52_4.grid(column=4,row=78)
b52_5.grid(column=3,row=78)
b52_6.grid(column=2,row=78)

b53_0.grid(column=16,row=78, ipadx=10)
b53_1.grid(column=15,row=78)
b53_2.grid(column=14,row=78)
b53_3.grid(column=13,row=78)
b53_4.grid(column=12,row=78)
b53_5.grid(column=11,row=78)
b53_6.grid(column=10,row=78)

b54_0.grid(column=24,row=78, ipadx=10)
b54_1.grid(column=23,row=78)
b54_2.grid(column=22,row=78)
b54_3.grid(column=21,row=78)
b54_4.grid(column=20,row=78)
b54_5.grid(column=19,row=78)
b54_6.grid(column=18,row=78)

b55_0.grid(column=32,row=78)
b55_1.grid(column=31,row=78)
b55_2.grid(column=30,row=78)
b55_3.grid(column=29,row=78)
b55_4.grid(column=28,row=78)
b55_5.grid(column=27,row=78)
b55_6.grid(column=26,row=78)


# Row 15 Draw

# defining labels
nameb56_0 = ttk.Label(content, text="Byte 56")
nameb57_0 = ttk.Label(content, text="Byte 57")
nameb58_0 = ttk.Label(content, text="Byte 58")
nameb59_0 = ttk.Label(content, text="Byte 59")


# Defining number type
b56_0var = IntVar()
b56_1var = IntVar()
b56_2var = IntVar()
b56_3var = IntVar()
b56_4var = IntVar()
b56_5var = IntVar()
b56_6var = IntVar()
b56_7var = IntVar()

b57_0var = IntVar()
b57_1var = IntVar()
b57_2var = IntVar()
b57_3var = IntVar()
b57_4var = IntVar()
b57_5var = IntVar()
b57_6var = IntVar()
b57_7var = IntVar()

b58_0var = IntVar()
b58_1var = IntVar()
b58_2var = IntVar()
b58_3var = IntVar()
b58_4var = IntVar()
b58_5var = IntVar()
b58_6var = IntVar()
b58_7var = IntVar()

b59_0var = IntVar()
b59_1var = IntVar()
b59_2var = IntVar()
b59_3var = IntVar()
b59_4var = IntVar()
b59_5var = IntVar()
b59_6var = IntVar()
b59_7var = IntVar()

# Setting default button position
b56_0var.set(0)
b56_1var.set(0)
b56_2var.set(0)
b56_3var.set(0)
b56_4var.set(0)
b56_5var.set(0)
b56_6var.set(0)
b56_7var.set(0)

b57_0var.set(0)
b57_1var.set(0)
b57_2var.set(0)
b57_3var.set(0)
b57_4var.set(0)
b57_5var.set(0)
b57_6var.set(0)
b57_7var.set(0)

b58_0var.set(0)
b58_1var.set(0)
b58_2var.set(0)
b58_3var.set(0)
b58_4var.set(0)
b58_5var.set(0)
b58_6var.set(0)
b58_7var.set(0)

b59_0var.set(0)
b59_1var.set(0)
b59_2var.set(0)
b59_3var.set(0)
b59_4var.set(0)
b59_5var.set(0)
b59_6var.set(0)
b59_7var.set(0)

# Defining button
b56_0 = ttk.Checkbutton(content, command=run56, text="0", variable=b56_0var, onvalue=0x01, offvalue=0x00)
b56_1 = ttk.Checkbutton(content, command=run56, text="1", variable=b56_1var, onvalue=0x02, offvalue=0x00)
b56_2 = ttk.Checkbutton(content, command=run56, text="2", variable=b56_2var, onvalue=0x04, offvalue=0x00)
b56_3 = ttk.Checkbutton(content, command=run56, text="3", variable=b56_3var, onvalue=0x08, offvalue=0x00)
b56_4 = ttk.Checkbutton(content, command=run56, text="4", variable=b56_4var, onvalue=0x10, offvalue=0x00)
b56_5 = ttk.Checkbutton(content, command=run56, text="5", variable=b56_5var, onvalue=0x20, offvalue=0x00)
b56_6 = ttk.Checkbutton(content, command=run56, text="6", variable=b56_6var, onvalue=0x40, offvalue=0x00)
b56_7 = ttk.Checkbutton(content, command=run56, text="7", variable=b56_7var, onvalue=0x00, offvalue=0x00)

b57_0 = ttk.Checkbutton(content, command=run57, text="0", variable=b57_0var, onvalue=0x01, offvalue=0x00)
b57_1 = ttk.Checkbutton(content, command=run57, text="1", variable=b57_1var, onvalue=0x02, offvalue=0x00)
b57_2 = ttk.Checkbutton(content, command=run57, text="2", variable=b57_2var, onvalue=0x04, offvalue=0x00)
b57_3 = ttk.Checkbutton(content, command=run57, text="3", variable=b57_3var, onvalue=0x08, offvalue=0x00)
b57_4 = ttk.Checkbutton(content, command=run57, text="4", variable=b57_4var, onvalue=0x10, offvalue=0x00)
b57_5 = ttk.Checkbutton(content, command=run57, text="5", variable=b57_5var, onvalue=0x20, offvalue=0x00)
b57_6 = ttk.Checkbutton(content, command=run57, text="6", variable=b57_6var, onvalue=0x40, offvalue=0x00)
b57_7 = ttk.Checkbutton(content, command=run57, text="7", variable=b57_7var, onvalue=0x00, offvalue=0x00)

b58_0 = ttk.Checkbutton(content, command=run58, text="0", variable=b58_0var, onvalue=0x01, offvalue=0x00)
b58_1 = ttk.Checkbutton(content, command=run58, text="1", variable=b58_1var, onvalue=0x02, offvalue=0x00)
b58_2 = ttk.Checkbutton(content, command=run58, text="2", variable=b58_2var, onvalue=0x04, offvalue=0x00)
b58_3 = ttk.Checkbutton(content, command=run58, text="3", variable=b58_3var, onvalue=0x08, offvalue=0x00)
b58_4 = ttk.Checkbutton(content, command=run58, text="4", variable=b58_4var, onvalue=0x10, offvalue=0x00)
b58_5 = ttk.Checkbutton(content, command=run58, text="5", variable=b58_5var, onvalue=0x20, offvalue=0x00)
b58_6 = ttk.Checkbutton(content, command=run58, text="6", variable=b58_6var, onvalue=0x40, offvalue=0x00)
b58_7 = ttk.Checkbutton(content, command=run58, text="7", variable=b58_7var, onvalue=0x00, offvalue=0x00)

b59_0 = ttk.Checkbutton(content, command=run59, text="0", variable=b59_0var, onvalue=0x01, offvalue=0x00)
b59_1 = ttk.Checkbutton(content, command=run59, text="1", variable=b59_1var, onvalue=0x02, offvalue=0x00)
b59_2 = ttk.Checkbutton(content, command=run59, text="2", variable=b59_2var, onvalue=0x04, offvalue=0x00)
b59_3 = ttk.Checkbutton(content, command=run59, text="3", variable=b59_3var, onvalue=0x08, offvalue=0x00)
b59_4 = ttk.Checkbutton(content, command=run59, text="4", variable=b59_4var, onvalue=0x10, offvalue=0x00)
b59_5 = ttk.Checkbutton(content, command=run59, text="5", variable=b59_5var, onvalue=0x20, offvalue=0x00)
b59_6 = ttk.Checkbutton(content, command=run59, text="6", variable=b59_6var, onvalue=0x40, offvalue=0x00)
b59_7 = ttk.Checkbutton(content, command=run59, text="7", variable=b59_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb56_0.grid(column=4, row=83, columnspan=2)
nameb57_0.grid(column=12, row=83, columnspan=2)
nameb58_0.grid(column=20, row=83, columnspan=2)
nameb59_0.grid(column=28, row=83, columnspan=2)

# Placing buttons on grid
b56_0.grid(column=8,row=84, ipadx=10)
b56_1.grid(column=7,row=84)
b56_2.grid(column=6,row=84)
b56_3.grid(column=5,row=84)
b56_4.grid(column=4,row=84)
b56_5.grid(column=3,row=84)
b56_6.grid(column=2,row=84)

b57_0.grid(column=16,row=84, ipadx=10)
b57_1.grid(column=15,row=84)
b57_2.grid(column=14,row=84)
b57_3.grid(column=13,row=84)
b57_4.grid(column=12,row=84)
b57_5.grid(column=11,row=84)
b57_6.grid(column=10,row=84)

b58_0.grid(column=24,row=84, ipadx=10)
b58_1.grid(column=23,row=84)
b58_2.grid(column=22,row=84)
b58_3.grid(column=21,row=84)
b58_4.grid(column=20,row=84)
b58_5.grid(column=19,row=84)
b58_6.grid(column=18,row=84)

b59_0.grid(column=32,row=84)
b59_1.grid(column=31,row=84)
b59_2.grid(column=30,row=84)
b59_3.grid(column=29,row=84)
b59_4.grid(column=28,row=84)
b59_5.grid(column=27,row=84)
b59_6.grid(column=26,row=84)


# Row 16 Draw

# defining labels
nameb60_0 = ttk.Label(content, text="Byte 60")
nameb61_0 = ttk.Label(content, text="Byte 61")
nameb62_0 = ttk.Label(content, text="Byte 62")
nameb63_0 = ttk.Label(content, text="Byte 63")


# Defining number type
b60_0var = IntVar()
b60_1var = IntVar()
b60_2var = IntVar()
b60_3var = IntVar()
b60_4var = IntVar()
b60_5var = IntVar()
b60_6var = IntVar()
b60_7var = IntVar()

b61_0var = IntVar()
b61_1var = IntVar()
b61_2var = IntVar()
b61_3var = IntVar()
b61_4var = IntVar()
b61_5var = IntVar()
b61_6var = IntVar()
b61_7var = IntVar()

b62_0var = IntVar()
b62_1var = IntVar()
b62_2var = IntVar()
b62_3var = IntVar()
b62_4var = IntVar()
b62_5var = IntVar()
b62_6var = IntVar()
b62_7var = IntVar()

b63_0var = IntVar()
b63_1var = IntVar()
b63_2var = IntVar()
b63_3var = IntVar()
b63_4var = IntVar()
b63_5var = IntVar()
b63_6var = IntVar()
b63_7var = IntVar()

# Setting default button position
b60_0var.set(0)
b60_1var.set(0)
b60_2var.set(0)
b60_3var.set(0)
b60_4var.set(0)
b60_5var.set(0)
b60_6var.set(0)
b60_7var.set(0)

b61_0var.set(0)
b61_1var.set(0)
b61_2var.set(0)
b61_3var.set(0)
b61_4var.set(0)
b61_5var.set(0)
b61_6var.set(0)
b61_7var.set(0)

b62_0var.set(0)
b62_1var.set(0)
b62_2var.set(0)
b62_3var.set(0)
b62_4var.set(0)
b62_5var.set(0)
b62_6var.set(0)
b62_7var.set(0)

b63_0var.set(0)
b63_1var.set(0)
b63_2var.set(0)
b63_3var.set(0)
b63_4var.set(0)
b63_5var.set(0)
b63_6var.set(0)
b63_7var.set(0)

# Defining button
b60_0 = ttk.Checkbutton(content, command=run60, text="0", variable=b60_0var, onvalue=0x01, offvalue=0x00)
b60_1 = ttk.Checkbutton(content, command=run60, text="1", variable=b60_1var, onvalue=0x02, offvalue=0x00)
b60_2 = ttk.Checkbutton(content, command=run60, text="2", variable=b60_2var, onvalue=0x04, offvalue=0x00)
b60_3 = ttk.Checkbutton(content, command=run60, text="3", variable=b60_3var, onvalue=0x08, offvalue=0x00)
b60_4 = ttk.Checkbutton(content, command=run60, text="4", variable=b60_4var, onvalue=0x10, offvalue=0x00)
b60_5 = ttk.Checkbutton(content, command=run60, text="5", variable=b60_5var, onvalue=0x20, offvalue=0x00)
b60_6 = ttk.Checkbutton(content, command=run60, text="6", variable=b60_6var, onvalue=0x40, offvalue=0x00)
b60_7 = ttk.Checkbutton(content, command=run60, text="7", variable=b60_7var, onvalue=0x00, offvalue=0x00)

b61_0 = ttk.Checkbutton(content, command=run61, text="0", variable=b61_0var, onvalue=0x01, offvalue=0x00)
b61_1 = ttk.Checkbutton(content, command=run61, text="1", variable=b61_1var, onvalue=0x02, offvalue=0x00)
b61_2 = ttk.Checkbutton(content, command=run61, text="2", variable=b61_2var, onvalue=0x04, offvalue=0x00)
b61_3 = ttk.Checkbutton(content, command=run61, text="3", variable=b61_3var, onvalue=0x08, offvalue=0x00)
b61_4 = ttk.Checkbutton(content, command=run61, text="4", variable=b61_4var, onvalue=0x10, offvalue=0x00)
b61_5 = ttk.Checkbutton(content, command=run61, text="5", variable=b61_5var, onvalue=0x20, offvalue=0x00)
b61_6 = ttk.Checkbutton(content, command=run61, text="6", variable=b61_6var, onvalue=0x40, offvalue=0x00)
b61_7 = ttk.Checkbutton(content, command=run61, text="7", variable=b61_7var, onvalue=0x00, offvalue=0x00)

b62_0 = ttk.Checkbutton(content, command=run62, text="0", variable=b62_0var, onvalue=0x01, offvalue=0x00)
b62_1 = ttk.Checkbutton(content, command=run62, text="1", variable=b62_1var, onvalue=0x02, offvalue=0x00)
b62_2 = ttk.Checkbutton(content, command=run62, text="2", variable=b62_2var, onvalue=0x04, offvalue=0x00)
b62_3 = ttk.Checkbutton(content, command=run62, text="3", variable=b62_3var, onvalue=0x08, offvalue=0x00)
b62_4 = ttk.Checkbutton(content, command=run62, text="4", variable=b62_4var, onvalue=0x10, offvalue=0x00)
b62_5 = ttk.Checkbutton(content, command=run62, text="5", variable=b62_5var, onvalue=0x20, offvalue=0x00)
b62_6 = ttk.Checkbutton(content, command=run62, text="6", variable=b62_6var, onvalue=0x40, offvalue=0x00)
b62_7 = ttk.Checkbutton(content, command=run62, text="7", variable=b62_7var, onvalue=0x00, offvalue=0x00)

b63_0 = ttk.Checkbutton(content, command=run63, text="0", variable=b63_0var, onvalue=0x01, offvalue=0x00)
b63_1 = ttk.Checkbutton(content, command=run63, text="1", variable=b63_1var, onvalue=0x02, offvalue=0x00)
b63_2 = ttk.Checkbutton(content, command=run63, text="2", variable=b63_2var, onvalue=0x04, offvalue=0x00)
b63_3 = ttk.Checkbutton(content, command=run63, text="3", variable=b63_3var, onvalue=0x08, offvalue=0x00)
b63_4 = ttk.Checkbutton(content, command=run63, text="4", variable=b63_4var, onvalue=0x10, offvalue=0x00)
b63_5 = ttk.Checkbutton(content, command=run63, text="5", variable=b63_5var, onvalue=0x20, offvalue=0x00)
b63_6 = ttk.Checkbutton(content, command=run63, text="6", variable=b63_6var, onvalue=0x40, offvalue=0x00)
b63_7 = ttk.Checkbutton(content, command=run63, text="7", variable=b63_7var, onvalue=0x00, offvalue=0x00)


content.grid(column=0, row=0)

# Placing text above each byte
nameb60_0.grid(column=4, row=89, columnspan=2)
nameb61_0.grid(column=12, row=89, columnspan=2)
nameb62_0.grid(column=20, row=89, columnspan=2)
nameb63_0.grid(column=28, row=89, columnspan=2)

# Placing buttons on grid
b60_0.grid(column=8,row=90, ipadx=10)
b60_1.grid(column=7,row=90)
b60_2.grid(column=6,row=90)
b60_3.grid(column=5,row=90)
b60_4.grid(column=4,row=90)
b60_5.grid(column=3,row=90)
b60_6.grid(column=2,row=90)

b61_0.grid(column=16,row=90, ipadx=10)
b61_1.grid(column=15,row=90)
b61_2.grid(column=14,row=90)
b61_3.grid(column=13,row=90)
b61_4.grid(column=12,row=90)
b61_5.grid(column=11,row=90)
b61_6.grid(column=10,row=90)

b62_0.grid(column=24,row=90, ipadx=10)
b62_1.grid(column=23,row=90)
b62_2.grid(column=22,row=90)
b62_3.grid(column=21,row=90)
b62_4.grid(column=20,row=90)
b62_5.grid(column=19,row=90)
b62_6.grid(column=18,row=90)

b63_0.grid(column=32,row=90)
b63_1.grid(column=31,row=90)
b63_2.grid(column=30,row=90)
b63_3.grid(column=29,row=90)
b63_4.grid(column=28,row=90)
b63_5.grid(column=27,row=90)
b63_6.grid(column=26,row=90)

# Initialise scan
dummy = ttk.Checkbutton(content, command=first)


# Defining Start/Stop buttons
start = ttk.Button(content, command=start_timer, text="Start")
alloff = ttk.Button(content, command=alloff, text="All")
blocka = ttk.Button(content, command=blocka, text=" 0 to  7")
blockb = ttk.Button(content, command=blockb, text=" 8 to 15")
blockc = ttk.Button(content, command=blockc, text="16 to 23")
blockd = ttk.Button(content, command=blockd, text="24 to 31")
blocke = ttk.Button(content, command=blocke, text="32 to 39")
blockf = ttk.Button(content, command=blockf, text="40 to 47")
blockg = ttk.Button(content, command=blockg, text="48 to 55")
blockh = ttk.Button(content, command=blockh, text="56 to 63")

content.grid(column=0, row=0)


start.grid(column=30, row=122, columnspan=4)
alloff.grid(column=21, row=123, columnspan=4)
blocka.grid(column=1, row=122, columnspan=4)
blockb.grid(column=5, row=122, columnspan=4)
blockc.grid(column=9, row=122, columnspan=4)
blockd.grid(column=13, row=122, columnspan=4)
blocke.grid(column=17, row=122, columnspan=4)
blockf.grid(column=21, row=122, columnspan=4)
blockg.grid(column=1, row=123, columnspan=4)
blockh.grid(column=5, row=123, columnspan=4)

# Author
nameCopy0 = ttk.Label(content, text="---------------------------------------------------------------------- Inputs Off (bytes) ------------------------------------------------------------------       ")
nameCopy1 = ttk.Label(content, text="D Walker 2014")
nameCopy0.grid(column=1, row=121, columnspan=24)
nameCopy1.grid(column=25, row=123, columnspan=4)

# Resize grip
ttk.Sizegrip().grid(column=1, row=1, sticky=(S,E))

# Window resizing
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
content.columnconfigure(0, weight=3)
content.columnconfigure(1, weight=3)
content.columnconfigure(2, weight=3)
content.columnconfigure(3, weight=3)
content.columnconfigure(4, weight=3)
content.columnconfigure(5, weight=3)
content.columnconfigure(6, weight=3)
content.columnconfigure(7, weight=3)
content.rowconfigure(1, weight=1)


init(root)
root.mainloop()