LouieFord

Untitled

Mar 16th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. import sqlite3
  2. from guizero import App, PushButton, ListBox, TextBox, Text
  3. from typing import List
  4.  
  5.  
  6. myconnection = sqlite3.connect("movie.db")
  7. mycursor = myconnection.cursor()
  8.  
  9. app = App(title="Movie Selector",layout="grid", bg="light blue")
  10.  
  11. def commit(genreinput, yearinput):
  12. mycursor.execute("""
  13. SELECT film.title,genre.genreName,film.releaseYear
  14. FROM film
  15. INNER JOIN filmgenre ON film.filmID = filmgenre.filmID
  16. INNER JOIN genre ON filmgenre.genreID = genre.genreID
  17. WHERE genre.genreName = ? AND film.releaseYear = ?""",
  18. (genreinput.value,yearinput.value))
  19. movielist = ListBox(app, items=([x[0] for x in mycursor.fetchall()]),grid=[5,5])
  20.  
  21.  
  22. genreinput = TextBox(app, text="", grid=[1,1])
  23. askgenre = Text(app, text="What genre of movie would you like?: ",grid=[0,1])
  24. yearinput = TextBox(app, text="",grid=[1,2])
  25. askyear = Text(app, text="What's the year of movies you would like to see?: ",grid=[0,2])
  26. submit = PushButton(app, text="Generate Movies!", command=commit, args=[genreinput,yearinput],grid=[0,3])
  27.  
  28. def highlight():
  29. quitApp.bg = "red"
  30.  
  31. def lowlight():
  32. quitApp.bg = "light blue"
  33.  
  34. quitApp = PushButton(app, command=quit, text="Quit App",grid=[0,5])
  35.  
  36. quitApp.when_mouse_enters = highlight
  37. quitApp.when_mouse_leaves = lowlight
  38.  
  39.  
  40. app.display()
Advertisement
Add Comment
Please, Sign In to add comment