1 year ago

#318909

test-img

None

Python PyQt6 ListWidget

I use list widget to store pytube stream objects currently I add to the list the title of the object ( text only ) parallelly I add the full object to list ( playlist_yt )

Here is the add function

 def add_to_playlist(self):

        if self.playlist_check.isChecked():
            print("checked")
            yt = YouTube(url).streams.get_audio_only(subtype="mp4")
            try:
                playlist_yt.append(yt)
            except Exception as e:
                print(e)

            self.playlist_obj.addItem(yt.title)

I try to create delete button to delete the selected line from widget

  def remove_item_pl(self):
        try:
            current_item =  self.playlist_obj.currentItem()  
        except Exception as e:
            print(e)
        if self.playlist_check.isChecked():

            try:
                self.playlist_obj.removeItemWidget(current_item)
            except Exception as e:
                print(e)

How we achieve that ?

python

python-3.x

qwidget

python-3.10

pyqt6

0 Answers

Your Answer

Accepted video resources