bcrowell2 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mysterious hardware/OSS/Gtk interaction?
by Khen1950fx (Canon) on Mar 11, 2011 at 07:40 UTC | |
by bcrowell2 (Friar) on Mar 11, 2011 at 16:01 UTC | |
by zentara (Cardinal) on Mar 11, 2011 at 16:17 UTC | |
by Khen1950fx (Canon) on Mar 11, 2011 at 23:20 UTC | |
by bcrowell2 (Friar) on Mar 12, 2011 at 00:13 UTC | |
|
Re: mysterious hardware/OSS/Gtk interaction?
by zentara (Cardinal) on Mar 11, 2011 at 15:31 UTC | |
by bcrowell2 (Friar) on Mar 11, 2011 at 16:07 UTC | |
by zentara (Cardinal) on Mar 11, 2011 at 16:26 UTC |