in reply to (bbfu) (neither $widget-SelectionHandle()) Re: Tk::Clipboard and the X Windows Clipboard
in thread Tk::Clipboard and the X Windows Clipboard

DoOneEvent() processes one event. See this article. Most Perl/Tk programs have a MainLoop, though, so the GUI can run.

HTH, --traveler

  • Comment on Re: (bbfu) (neither $widget-SelectionHandle()) Re: Tk::Clipboard and the X Windows Clipboard

Replies are listed 'Best First'.
(bbfu) (thanks, but no GUI) Re2: (bbfu) (neither $widget-SelectionHandle()) Re: Tk::Clipboard and the X Windows Clipboard
by bbfu (Curate) on Oct 30, 2001 at 02:35 UTC

    Thanks. That article is exactly what I was looking for. Actually, though, for this particular application, I don't want a GUI. I'm creating a command-line utility to manipulate the X windows selection/clipboard. Tk was just the only thing I could see right off that let me do that.

    Thanks for your help. :-)

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.

(bbfu) (still not working; time based) Re2: (bbfu) (neither $widget-SelectionHandle()) Re: Tk::Clipboard and the X Windows Clipboard
by bbfu (Curate) on Oct 30, 2001 at 07:37 UTC

    Blah. I can't get it to work with DoOneEvent(), $mw->update(), or even $mw->idletasks(). :-(

    The problem, as far as I can tell, is that it is not based on how many events are executed (though they need to be executed, otherwise the callback is never called) but, rather, on how long the program remains active. With the following code, it almost never works with $ARGV[0] = 1, sometimes works with 2, pretty much always works with 3, and is (presumably) guaranteed with 5 and above.

    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); $mw->withdraw(); $mw->clipboardClear(); $mw->clipboardAppend('clip'); $mw->after($ARGV[0], [$mw, 'destroy']); MainLoop;

    I don't suppose you have any ideas on how I could go about this in a way that doesn't seem so... well, kludgey?

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.

      Only thing I can think is to find examples.

      Here I give some I found which seem to have something somewhat related...

      Sorry, have to catch a train now. :)

      I had three ideas: 1) try the Xt calls directly (I cannot find a module that lets you get to Xt directly, so this may not be easy), 2) try setting the clipboard value, then testing to see if it is available. If it is, then exit. (I have no idea if this will work or not). 3) Switch to gtk and see if you can do it easily from gtk. gtk plays well with perl...

      HTH, --john