O monks,

I have a perl-gtk oscilloscope application that works just fine on my development machine. However, the first time I ran it on a different machine, I found that the Gtk buttons mysteriously were not drawn, although it seems as though clicking on them does have an effect. The following is a minimal example that demonstrates the problem. All of this is on linux (ubuntu 10.04 and 10.10). The sound input is done using OSS emulation, so if you're running a unix that doesn't have OSS emulation (e.g., ubuntu 10.10), you need to install the aoss utility (packaged in debian package alsa-oss), and run the program like so: "alsa foo" (where "foo" is the file containing the sample code). If you run it, you may or may not find that the button gets drawn.

#!/usr/bin/perl use warnings; use strict; use Glib qw/TRUE FALSE/; use Gtk2 -init; use IO::File; my $window = new Gtk2::Window ( "toplevel" ); $window->signal_connect ("delete_event", sub { Gtk2->main_quit; }); my $button = Gtk2::Button->new('foo'); $window->add($button); $window->show_all; my $dsp = new IO::File("</dev/dsp"); my $event_source_tag = Glib::IO->add_watch( fileno($dsp), 'in', sub { my $buff = " " x 1024; my $nread = read($dsp,$buff,1024); return 1; } ); Gtk2->main; exit(0);

Does anyone have any insight into what might be causing this problem and how to solve it? I'm at wit's end. Although it runs on the development machine, it has failed on three out of three other machines I tried it on. There doesn't seem to be any common denominator, e.g., the version of the OSS doesn't predict whether it will work or not.

Thanks in advance!

-Ben


In reply to mysterious hardware/OSS/Gtk interaction? by bcrowell2

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.