john-jones
john-jones

Reputation: 7780

Perl tk main window error

I have a Perl Tk application.

If I move the main window so that it's not right up to the uppermost part of the screen, then the next time the following code is executed, the script fails:

$canvas_fimage_real=$canvas_fimage->Subwidget('canvas');
$canvas_fimage_real=$canvas_fimage unless $canvas_fimage_real;
my $canvas_id=$canvas_fimage_real->id;

my $canvas_fimage_photo=$main_window::main_window->Photo(-format=>'Window', -data=>oct $canvas_id );

And it fails with the following error message:

X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  73 (X_GetImage)
  Serial number of failed request:  2796
  Current serial number in output stream:  2796

The script crashes at the Photo command.
How can I fix this?

Upvotes: 1

Views: 361

Answers (1)

Donal Fellows
Donal Fellows

Reputation: 137577

Is this a window that is wholly on the screen? The snapshotting facility only works with what is visible on-screen (a low-level X11 condition; not negotiable). As such, you should file a bug report as the snapshot code shouldn't ask for things that it can't get.

Of course, if the window is fully on screen and you're getting that error message anyway, that's a serious problem. File a bug report in that case too!

Upvotes: 2

Related Questions