| 112 | |
| 113 | |
| 114 | def search_button(p1): |
| 115 | global cursor |
| 116 | global results |
| 117 | global index |
| 118 | w.errorOutput.configure(text="") |
| 119 | sql_command = """ SELECT * FROM notes WHERE title LIKE "%{0}%";""" |
| 120 | sql_command = sql_command.format(w.inputSearchTitle.get()) |
| 121 | try: |
| 122 | cursor.execute(sql_command) |
| 123 | results = cursor.fetchall() |
| 124 | w.errorOutput.configure(text=str(len(results)) + " results") |
| 125 | index = 0 |
| 126 | if index >= 0 and index < len(results): |
| 127 | w.outputNotice.delete(1.0, END) |
| 128 | w.outputNotice.insert(1.0, results[index][2]) |
| 129 | except: |
| 130 | w.errorOutput.configure(text="Please create at first a database.") |
| 131 | |
| 132 | |
| 133 | def next_button(p1): |