Phoenix
Phoenix copied to clipboard
Problem with wx.media.MediaCtrl on Debian
Operating system: PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian
wxPython version & source: '4.2.0 gtk3 (phoenix) wxWidgets 3.2.0'
Python version & source: Python 3.9.10 (main, Jan 22 2023, 16:30:49)
Description of the problem: I have probleme with wx.media.MediaCtrl which crash program when frame is showed with .show() function. The error message displayed is :
X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 2 (X_ChangeWindowAttributes) Resource id in failed request: 0xda47c110 Serial number of failed request: 51 Current serial number in output stream: 54
Is-it possible to fix it ? Philippe
Code Example (click to expand)
import wx
import wx.media
import os
class TestPanel(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='Media Player')
#self.testMedia = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER, szBackend=wx.media.MEDIABACKEND_WMP10)
self.testMedia = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER)
self.chemin = os.path.dirname(os.path.abspath(__file__))
self.media = self.chemin + '/Droite_1.mp4'
self.testMedia.Bind(wx.media.EVT_MEDIA_LOADED, self.play)
self.testMedia.Bind(wx.media.EVT_MEDIA_FINISHED, self.quit)
self.Bind(wx.media.EVT_MEDIA_STOP, self.OnMediaStop, self.testMedia)
self.Bind(wx.EVT_CLOSE, self.quit)
if self.testMedia.Load(self.media):
pass
else:
print("Media not found")
self.quit(None)
self.Show()
def play(self, event):
self.testMedia.Play()
def quit(self, event):
self.testMedia.Stop()
self.Destroy()
# Sets the mp4 file in a loop for testing only
def OnMediaStop(self, event):
self.testMedia.Seek(0)
event.Veto()
if __name__ == '__main__':
app = wx.App()
Frame = TestPanel()
app.MainLoop()
Are you using X11 or Wayland?
I'm on WSL debian on Windows 11
This issue has been mentioned on Discuss wxPython. There might be relevant details there:
https://discuss.wxpython.org/t/ubuntu-linux-wxpython-mediactrl-fails-under-wayland/36746/2