App-MediaPi

 view release on metacpan or  search on metacpan

script/mediapi  view on Meta::CPAN

                                                     -command => sub { send_cmd('prev') });
$prev_btn->g_grid(-column => 0, -row => 1, -sticky => 'nswe', -padx => 10, -pady => 10);
my $next_btn = $media_control_frame->new_ttk__button(-text => '⏭', -style => 'Unicode.TButton',
                                                     -command => sub { send_cmd('next') });
$next_btn->g_grid(-column => 1, -row => 1, -sticky => 'nswe', -padx => 10, -pady => 10);
my $status_label = $media_control_frame->new_ttk__label(-textvariable => \$track_status, -anchor => 'center');
$status_label->g_grid(-column => 0, -columnspan => 2, -row => 2, -sticky => 'nswe');

# This remove the focus and "active" decoration of the button when they are selected.
# We might want some kind of feedback that they were selected though.
Tkx::bind('TButton', '<FocusIn>', [sub { $wnd->g_focus(); Tkx::widget->new($_[0])->state('!active'); }, Tkx::Ev('%W')]);

# The commands are documented at https://abyz.me.uk/rpi/pigpio/pigs.html
# For now we don’t have a gpio for that as 18 is used by the I2S audio, we need
# to route another one to that pin on the screen.
# syswrite $pigpio, "w 18 1\n";  # Switch on the backlight of the screen.

#Tkx::bind('.', '<Create>', sub {
Tkx::after('idle', sub {
  send_cmd();  # Used to read the greeting message until the first caret >.
  get_status();
});
print "Starting main loop\n";
Tkx::MainLoop();



( run in 0.501 second using v1.01-cache-2.11-cpan-2398b32b56e )