Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w -- use Wx 0.15 qw[:allclasses]; use strict; package MyFrame; use Wx qw[:everything]; use base qw(Wx::Frame); use strict; sub new { my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name; $style = wxDEFAULT_FRAME_STYLE unless defined $style; $self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $sty +le, $name ); $self->SetTitle("Draw/Video Controls"); $self->{Ctl_Videos_Sizer_2} = Wx::BoxSizer->new(wxVERTICAL); + # Top-level left-hand sizer (contains media) # wxMEDIABACKEND_DIRECTSHOW Use ActiveMovie/DirectShow. Requires w +xUSE_DIRECTSHOW to be enabled, requires linkage with the static libra +ry strmiids.lib, and is available on Windows Only. # wxMEDIABACKEND_QUICKTIME Use QuickTime. Windows and Mac Only. NO +TE: On Mac Systems lower than OSX 10.2 this defaults to emulating win +dow positioning and suffers from several bugs, including not working +correctly embedded in a wxNotebook. # wxMEDIABACKEND_MCI Use Media Command Interface. Windows Only +. # wxMEDIABACKEND_GSTREAMER Use GStreamer. Unix Only. # wxMEDIABACKEND_WMP10 Windows Media Player 9 or 10 # wxMEDIABACKEND_REALPLAYER Realplayer # Blank Allow to choose own player $self->{Ctl_Videos_Media}= Wx::MediaCtrl->new( $self, wxID_ANY, '' +, wxDefaultPosition, [400,300],0, ); $self->{Ctl_Videos_Media}->Show( 1 ); $self->{Ctl_Videos_Media}->ShowPlayerControls(wxMEDIACTRLPLAYERCON +TROLS_DEFAULT); # or wxMEDIACTRLPLAYERCONTROLS_NONE # wxMEDIACTRLPLAYERCONTROLS_STEP # wxMEDIACTRLPLAYERCONTROLS_VOLUME # wxMEDIACTRLPLAYERCONTROLS_DEFAULT $self->{Ctl_Videos_Sizer_2}->Add( $self->{Ctl_Videos_Media}, 0, 0, + 0 ); $self->{Ctl_Videos_ImageViewer_Panel_1} = Wx::Panel->new($self, wx +ID_ANY, wxDefaultPosition, [400,20], ); $self->{Ctl_Videos_Sizer_2}->Add($self->{Ctl_Videos_ImageViewer_Pa +nel_1}, 0, 0, 0); $self->{Ctl_Videos_Button} = Wx::Button->new($self, wxID_ANY, "Loa +d", ); $self->{Ctl_Videos_Sizer_2}->Add($self->{Ctl_Videos_Button}, 0, 0, + 0); Wx::Event::EVT_PAINT($self->{Ctl_Videos_ImageViewer_Panel_1},\&pai +nt); Wx::Event::EVT_BUTTON( $self, $self->{Ctl_Videos_Button}, \&on_med +ia_load ); $self->SetSizer($self->{Ctl_Videos_Sizer_2}); $self->{Ctl_Videos_Sizer_2}->Fit($self); $self->Layout(); return $self; } sub on_media_load { # # Load file button selected # my( $self, $event ) = @_; my $file = Wx::FileSelector('Choose a media file'); # Select vi +deo file if( length( $file ) ) { $self->{Ctl_Videos_Media}->LoadFile ($file); # Load vid +eo file $self->{mediafile}= $file; # Store location of video fi +le in '$self # $self->{Ctl_Videos_Media}->Play(); } } sub paint{ my ($self,$event) = @_; my $dc = Wx::PaintDC->new($self); $dc->DrawRectangle( 0,0, 400,20 ); $event->Skip; } package main; unless(caller){ local *Wx::App::OnInit = sub{1}; my $app = Wx::App->new(); Wx::InitAllImageHandlers(); my $frame_1 = MyFrame->new(); $app->SetTopWindow($frame_1); $frame_1->Show(1); $app->MainLoop(); }

In reply to Wx::MediaCtrl and Wx::PaintDC by Steve_BZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-14 07:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found