resizing a media ctrl after creation

14 views
Skip to first unread message

Nathan smith

unread,
Dec 19, 2021, 11:32:29 AM12/19/21
to wxpytho...@googlegroups.com
Hi list,


I was wondering, is it possible to resize a media control after you have
created it?


I have the following in the code that adds the control to my screen:

  hbox4 = wx.BoxSizer(wx.HORIZONTAL)
  self.mediactrl=wx.media.MediaCtrl(panel, size(700, 700),
style=wx.media.MEDIACTRLPLAYERCONTROLS_NONE)
  self.mediactrl.SetName("Video.")
  self.mediactrl.Bind(wx.media.EVT_MEDIA_LOADED, self.beginplay)
  hbox4.Add(self.mediactrl,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5)


Then in beginplay I have a clal to play to start the media. I simply
wondered if there was a way to resize the control to best fit the video?

I see GetBestSize and assume I could use that when the video has been
loaded, but that's about as far as I got.


Best

Nathan


Transana

unread,
Dec 20, 2021, 11:06:42 AM12/20/21
to wxpytho...@googlegroups.com
You absolutely can resize the media control after it is created.
GetBestSize() returns a wx.Size, which is a recommendation for what size
the MediaCtrl thinks you should set.  It's still up to you to set the
size of the MediaCtrl using SetSize().

I personally don't use GetBestSize().  For me, the best size is
determined by a number of factors related to my application and user
configuration rather than the video itself.  But that's just me.

David
Reply all
Reply to author
Forward
0 new messages