in reply to Re^3: Perl/TK KeyPress/Release minimized
in thread Perl/TK KeyPress/Release minimized

I don't know how you could do what you want. You seem to want to override the basic window focus mechanism. You essentially would be creating a keystroke logger. I just saw PyKeyLogger I was wondering how to convert that to Perl?

The best solution is to build a single app, that incorporates the browser view and the pan controls... see embedding Dillo Html browser in a Tk app. I havn't had much luck with it, but Gtk2 has a MozEmbed library, which supposedly lets you embed applications with Mozilla. This is where Java has a great advantage over Perl, with it's java brower plugin. Maybe switch to java, or write a Flash program that can be run in the browser?

Another suggestion is google for "xbindkeys", and setup a daemon to intercept the keys, or google for "xvkdb"... the X virtual keyboard.

Is it possible to use the "tab focus shift" mechanism (or whatever your window manger uses to shift focus by the keyboard) to toggle focus between the browser and Tk app?

Is it really that hard to move the mouse back and forth between the browser and Tk window? There are ways to keep the Tk window "on top" if your window manager hides it when out of focus.


I'm not really a human, but I play one on earth. Cogito ergo sum a bum
  • Comment on Re^4: Perl/TK KeyPress/Release minimized

Replies are listed 'Best First'.
Re^5: Perl/TK KeyPress/Release minimized
by Anonymous Monk on Mar 24, 2008 at 19:09 UTC
    I found a .c program that will listen and react to the KeyPress and KeyRelease events in the background and I guess I can make it work with a Perl daemon, but it seems so simple that I wish Perl/tk could handle it. I really need it to work the way I described so that it can be used with a lot of different web based camera applications.
      I don't know what you mean by a "web based camera application"; BUT if it's web based, you should be able to communicate with it thru LWP or WWW::Mechanize.

      So why not make a Tk application, that gets the current camera image thru LWP, and puts it on a Canvas, then have your Pan Control Arrows below it? You could make it threaded, so the images are updated as fast as your network will allow, and your pan controls work in a different thread?


      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
        wow... that sounds complicated...lol I'm trying to use my basic Pan/Tilt/Zoom app along with flash based web camera applications. Many websites use flash to stream video back and forth from user to user and I want to be able to use my application to control my camera when I'm using their steaming application. As I've said, it all works very well at this point except the keyboard bindings that don't work when my application loses focus. I guess I'll set up a socket and run the key logging application actkbd.c to send events to my application, but I wanted a cleaner, strickly Perl way of doing it all.