First of all. Thanks! To anyone who takes their time to look at my question and answer it. i tried googling but I couldn’t find an answer. The documentation also didn’t help much.
I’ve started learning wxPython recently and I’m trying to make a GUI for youtube-dl
I used wxFormBuilder to make the GUI layout and then went in to code in another script by importing the code generated by wxFormBuilder. the GUI works right but I cant get the index of the values I select from the drop down menu.
This is the section of the code that defines the properties of the combobox
quality_selection_drop_downChoices = [ u"720p", u"Best Quality Available", u"Audio (mp3)", u"Non Youtube" ] self.quality_selection_drop_down = wx.ComboBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), quality_selection_drop_downChoices, 0 ) self.quality_selection_drop_down.SetSelection( 4 ) gbSizer1.Add( self.quality_selection_drop_down, wx.GBPosition( 2, 1 ), wx.GBSpan( 1, 3 ), wx.ALL|wx.EXPAND, 5 )
This is the code I wrote to check if the combobox values are returned correctly
def video_dl(self, event): print(self.quality_selection_drop_down.GetSelection)
The video_dl command is set as an event for a button in the GUI. It returns
<built-in method GetSelection of ComboBox object at 0x0000017820621670>
Instead of giving the index of the selection I’m choosing. I tried it with GetSelection, GetCurrentSelection, GetValue, GetString, GetStringSelection. All of them return an output in the same vein as the one mentioned above.
The entire code is on github so you can take a look at the whole code : github repo
Any help is greatly appreciated!! Thank you!