If your database supports the "TOP" clause, you can use that. If not, then this is usually done by calling setMaxRows() on the Statement object in JDBC. Since you are using beans binding, I have no idea what to tell you because I don't have any api docs for that model and I've never touched it.
Edit: If you're using the Persistence API Query object, there is a setMaxResults() method available.
root = tkinter.Tk()
buttons=[i for i in range(10)]
#If specific button is pressed, output "YES"
for num in buttons: