Important: Please read the Qt Code of Conduct -

how to restore windows taskbar thumbnail in PyQt5 if it was manipulate by vlc

  • hello,I am embedding python vlc in pyqt5 to make a video player.I never noticed whats going on taskbar,suddenly i came to know that when video starts to play it takes entire taskbar thumbnail to show only its video not other items present in the window screen.And after closing the video the taskbar becomes totally blank white, not showing anything .Is there any method to restore it normal.
    i have posted my every details with images for better understanding .in the stackoverflow look here.But wont get any desired answer.
    You might ask this, why i am using vlc and this is not a PyQt5 related issue.But the thing is i know vlc is manipulating the taskbar thumbnail to render its video but in PyQt5 there is a classQt Windows Extras Available and As per doc we can set setIconicLivePreviewPixmap(const QPixmap &) thumbnail. So can we reset/reassert the window taskbar thumnail like before ,after closing the vlc player or even while playing.?I am very curious to do that but dont know how to do??
    I am using PyQt 5.15.2 in windows8.1 32 bit
    Any help will be appreciated.Let me know if u dont understand my problem ,i think the stackoverflow link will be enough to make you clearly understand.

  • Lifetime Qt Champion


    Why are you replacing showEvent of your videoframe object ?

    You are likely breaking some stuff doing that.

  • @SGaist Please help me how to fix that I mean how to restore the thumbnail.

  • Lifetime Qt Champion

    If you need to do something when showEvent is called, then you should rather implement a custom QFrame to properly overload that method and do what you want there.

  • @SGaist basically once VLC started playing it covers entire thumbnail and it no longer in the control of my application even when I stopped playing and hide that frame the thumbnail is completely blank white .So Is there any way to extract live thumbnail from application or reinsert it. Or is there any way like grabmaouse()/grab keyboard() so I can grab my application thumbnail back?

  • Lifetime Qt Champion

    Then I would check with VLC to see what is going on. You might found an unexpected behaviour.

  • @SGaist Yes, go with my stackoverflow code .It will be easier for you.

  • Lifetime Qt Champion

    Sorry, what I meant by "I would check" is: if I was at your place, I would start by checking what the VLC folks are doing with the thumbnail.

  • @SGaist I have already raised an issue at Python-VLC GitHubcheck here. they said it is neither Python-VlC nor VLC issue rather I need to ask Pyqt5/Qt. So I came here.If I can reinsert it then it will be a temporary fix for me. So I am asking..

  • @SGaist Is there any way?

  • Lifetime Qt Champion

    One thing you can check is if you have the same behaviour with PySide2.

  • @SGaist I checked with PySide2,Same problem.I think VLC is somehow controlling thumbnail. So we need to reinsert it again.

  • @SGaist I figured out something. When VLC started it forcely set the only video frame to the taskbar thumbnail where it is about to play/render on and when the player stops the taskbar show blank as it(the frame where video was played)does not contain anything after stopping the player . So here we have to do something with thumbnail so that it can cover the entire application.I figured out this by setting that frame background color. It is not actually blank, after hiding that frame anything present in the size range of that frame appears in the thumbnail
    .So Is there any way to fix that?

  • Lifetime Qt Champion

    Can you post where you saw that ?

  • @SGaist 1st image brfore playing
    bandicam 2020-12-04 14-22-35-996.jpg
    2nd image while playing
    bandicam 2020-12-04 14-16-21-573.jpg
    3rd image after stopping and hiding that frame
    bandicam 2020-12-04 14-32-19-009.jpg

  • @SGaist As you can see in the 1st image, i set the window and videoframe background blue and yellow respectively.i Placed the red button in the size range of videoframe and both buttons are visible clearly in thumbnail( 1st image). and when video started playing it only show the videoframe in thumbnail as you can see in 2nd imagevideo with red button both but not that green button .In the third image you can see only the red button that's because vlc forcely set only that frame to the thumbnail .Any thing in the size range of that frame will be seen in thumbnail section.This is unexpected .
    Let me know if you have not understood.

  • Lifetime Qt Champion

    In your code you replace the showEvent implementation with setthumbnail but you do not call it anywhere else. So unless you trigger it again, it will have no effect.

  • @SGaist Though I have not written in that code but I attempted several times in different different experiment for curiosity,but that has no effect.

  • Lifetime Qt Champion

    Can you share the latest version of your tests ?

  • @SGaist No, actually I moved on from that part and now I fixed the issue. As I said VLC set that frame into taskbar,and it can also be done using windows API ITaskbarList3::SetThumbnailCliphere and it will create no issue if someone design a media player application only but in my case I am just embedding that for some time.and if after stopping the player the thumbnail will be blank then it will be a problem for me.Finally I asked this issue how to use this API in the stack overflow but got no desired answer ,then I asked in the Discord Python Forums and One person helped me to fix that.You can see here.I think in PyQt5 Qt Windows Extras's QWinThumbnailToolBar Class should also have setThumbnailClip method like setIconicThumbnailPixmap() and others.

  • Lifetime Qt Champion

    Thanks for the feedback !

    If you would like to have something like that, you should open a feature request on the bug report system. PyQt will likely not provide APIs that are not part of Qt itself.

Log in to reply