Assuming that you want a 8-bit binarynumber and your input contains only printable-chars:
First: convert the string (assuming it is a string) to a c string (with string.c_str() )
Now you'll have an array of chars which can be converted very easily to ints. Now convert this number to binary (by using the mod-operator for example) and you're done.
Or you could use bitwise-operators, but if you are new to programming, this won't make very much sense to you.
Did some reading and I have a better solution:
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: