Whenever I run my code, there's a 50/50 chance it crashes when my dropdown menu is clicked, coming up with a "Segmentation fault: 11" on vscode, I've also tried on pycharm. there is no apparent reason that this code shouldn't work, so I would like to know if there is a different way to create a dropdown menu, thanks! Code in question:
options = [ "AM", "PM" ]
variable = StringVar()
variable.set(options[0])
am_pm = OptionMenu(root, variable, *options)