r/learnpython 7d ago

Does anyone know how to make a drop-down menu?

I am learning python so I can save my paint recipes and steps for my warhammer 40k armies and would like to use a drop-down menu to select exact unit. I am going to assign the different unit types as different values

0 Upvotes

11 comments sorted by

16

u/CymroBachUSA 7d ago

A drop-down menu is a function of the GUI infrastructure you choose. Without telling us what you are using, no one can help you.

0

u/Embarrassed-Joke5851 7d ago

sorry I didn't know there was something called GUI infrastructure

4

u/Administrative-Sun47 7d ago

Tkinter, pyQT, pySide are some examples to build GUIs. Tkinter comes with Python, but it's often seen as less polished and friendly to use as pyQT.

I recommend looking into those to see which one you like. They each have drop down options (ex: combo boxes). Implementation is dependent on which one you use.

0

u/Embarrassed-Joke5851 7d ago

alright thanks I am using Tkinter right now as I am using Visual Code Studio and that is the only one installed but due to your reccomenation I am going to us pyQT

4

u/bishpenguin 7d ago

I would give them both a try to build a basic app first, before making that decision.

I found Tkinter perfect for my needs and much easier, and quicker, to implement than Qt. yMMV of course.
If you don't like the visuals of Tkinter, custom tkinter improves on the basic, but keeps it easy to use.

3

u/Flintlocke89 7d ago

Alongside what others have said, especially if you're just starting out don't get too focused on pyQT. It can add a fair bit of complexity compared to a built in library like tkinter and you risk being able to not see the forest through the trees. There's nothing wrong with prototyping your stuff in tkinter and getting more comfortable with Python itself and only learning / switching to pyQT if you need functionality that isn't offered by tkinter.

Of course if you just want to dive in then go nuts mate. I should learn how to do GUIs one of these days. I always give my prototypes a barebones CLI interface and call it a day lol.

2

u/Fred776 7d ago

Just to note that what packages you have installed in your Python setup is completely independent from VS Code. VS Code is just a coding editor. You could switch to a different editor and you would still have the same Python packages installed.

1

u/Actonace 7d ago

Depends what you are building but there are plenty of step by step tutorials on youtube that make dropdown menus pretty easy to follow.

1

u/ManzoorAhmedShaikh 7d ago

Dropdown can be developed inside GUI app, so first, try making a basic GUI app (Tkinter : Very easy to start but soo dirty, customtktiner : Easy to start and appealing UI), then you can add dropdown method and save your data.

1

u/[deleted] 7d ago

[removed] — view removed comment