Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

GUI Programming

by vroom (Pope)
on May 31, 2000 at 21:24 UTC ( #15653=sourcecodesection: print w/ replies, xml ) Need Help??
Server Status Monitor
on Jun 24, 2002 at 16:35 UTC
by xjar
Just a simple server status monitor written in Perl/Tk. Run as root, or with root priveledges on a *nix system for ICMP ping to work. Works on Win32 as well.

Probably not the cleanest or well thought out code in the world, but that's why I'm posting it. I wouldn't mind getting feedback on ways to clean up parts of it, specifically I'd like to rid myself of $serverCount. I've done some fiddling, but haven't as yet been able to do this.

I've kept all comments in just in case my code is so bad in places as to be difficult to understand (which I don't think it is, but you never know) :)

UPDATE: Added user customizability for color settings and refresh rates on the server list (program has to restart for refresh rate change to take effect). Have yet to add grinder's suggestion to use sockets instead of Net::Ping.

UPDATE: Switched from Net::Ping to IO::Socket to determine if a server is alive or not. Thanks for the idea grinder!

UPDATE: Small fixes including adding a Port listbox, and aesthetic alignment of subwindows.

GNOME Panel Applet SSH Menu
on Jun 07, 2002 at 14:26 UTC
by grantm
Update: I have since re-implemented this functionality (with configuration dialogs) using Gtk and Ruby. It's available here.

Warning: Don't use this script as an example of how to write Gtk GUI code in Perl - it uses the old 'Gtk' API (which was current in 2002 when I wrote the script) not the more modern Gtk2 API.

This script scratches a particular itch of mine - I'm administering multiple hosts and regularly want to open a new SSH session to a particular host in a new window. This script provides the list of hosts as a drop-down menu.

It's my first attempt at a GNOME panel applet so I'm interested in feedback from Perl-Gtk gurus who spot unduly complex bits. I'm posting this because I didn't find much in the way of sample code on the web.

I'm running RedHat 7.3 and Ximian GNOME so if it doesn't work for you, you may need to upgrade to the latest versions. The only module I needed over and above RH+Ximian was XML::Simple, but I had that already :-)

Ultimately, I want to implement a configuration dialog but it's functional now so here goes ...

WxBrowser - a wxPerl HTML Browser
on May 06, 2002 at 14:42 UTC
by crazyinsomniac
A crude HTML Browser written using wxPerl. More of a minimalistic demo than anything. Nice layout IMO (a hint of things to come).

If you want the GOBAR at the bottom, just ## switch these two lines, the wxBOTTOM or wxTOP don't matter
$sizer1->Add( $sizer3, 0, wxGROW|wxTOP, 0 );
$sizer1->Add( $sizer2, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 0 );

ptknotes
on Apr 19, 2002 at 21:13 UTC
by strredwolf
Sticky notes in Perl/Tk. Crude but effective. Hit 'new' to make a new note, 'saved' to show all notes you've written and closed. Saves in ~/.ptknotes
Perl/Tk Lights Out
on Dec 03, 2001 at 19:25 UTC
by Rhose
Not having used the grid geometry manager in Tk, and not having included pod documentation (redundant), I threw together this version of the Tiger Elctronic's Lights Out game to play with both concepts. I would appreciate any comments on the code (suggestions for improvement would be great). I am also interested in comments on this dumb habbit I picked up -- creating all my GUI objects in a hash array.
Tk based game
on Nov 08, 2001 at 18:08 UTC
by Aighearach
This is a little stress reliever I wrote in mid September 2001. It is a useful demonstration of basic Perl/Tk programming, including Pixmaps, mouse events, text, and window placement. May be slightly buggy in windows, I don't remember.

Edit (davorg): Title changed

The GUI Loft--A Win32::GUI Design Tool
on Aug 27, 2001 at 22:14 UTC
by jplindstrom
The GUI Loft is a powerful and easy-to-use WYSIWYG design tool for designing Win32::GUI Windows.

There is a User Manual, a Programmer's Reference, Demo code, and a support mailing list.

The code is around 300K and changing a lot, so I won't post it here, but you can download the source and binary at the home page: http://www.darserman.com/Perl/Loft

After designing the window in The GUI Loft, this is what the Perl code looks like to bring it into your program:

use Win32::GUI; use Win32; use Win32::GUI::Loft::Design; my $fileWindow = "fetch.gld"; #You created this using The GU +I Loft my $objDesign = Win32::GUI::Loft::Design->newLoad($fileWindow) or die("Could not open window file ($fileWindow)"); my $win = $objDesign->buildWindow() or die("Could not build window ($fileWindow)"); $win->Show(); Win32::GUI::Dialog();

I hope you'll like it!

/J

Tk::Style
on Aug 14, 2001 at 12:04 UTC
by Petruchio
Tk::Style implements stylesheet support for Perl/Tk, allowing one to separate presentation details from one's code and reduce the number of redundant parameters supplied to methods.

Update - Thu Aug 16 18:24:38 EDT 2001
Version 0.4 uploaded. Merely aesthetic changes since 0.2, API changes since 0.1; check the POD for details.

Tk::Carp
on Aug 14, 2001 at 02:46 UTC
by bbfu

Module to allow easy viewing of warnings and errors from a console-less Perl/Tk program.

From the POD:

When Perl programs are run in a GUI environment, it is often desirable to have them run with no console attached. Unfortunately, this causes any warnings or errors to be lost. Worse, fatal errors can cause your program to silently disappear, forcing you to restart the program, attached to a console, and hope you can reproduce the error.

This module makes it easy to see any errors or warnings your console-less program might produce by catching any errors and/or warnings and displaying them in a pop-up dialog box using Tk. It is similar in spirit to CGI::Carp's fatalsToBrowser and warningsToBrowser special import directives.

Update: Version 1.1; fixed some bugs, added some interface features.

Update: Version 1.2; Added some more features, and changed how the module works with regards to Tk::Error.

WebPic Beta
on Jun 25, 2001 at 23:35 UTC
by djw
** update ** I fixed a small typo in the thumbnail sub and a small error in my html tags. djw - June 27/01. Sorry if the code format is off a bit, I was testing out Komodo as an editor.

You can find the latest and greatest version at my site. You can find win32 binaries of Tk as well as html examples of output.

WebPic Beta
================================

What it does:

Read in a directory of digital cam pics, scale them to whatever percentage you want(in multiples of 10), provide an option for descriptions, and write an html page for viewing pictures.


0.3.6 Changelog
***************
- removed all hard coded paths/names - added to options
- added html style types - cascade and thumbnails
- added some defaults for the options window
- added clear and cancel buttons to options
- added a help menu (this file) - will include more later

0.3.5 Changelog
***************
- finished options window
- added a new dir location option
- Added a scale value
- finished html output default

0.3.0 Changelog
***************
- Added GUI - too much to name, first real version


To Do:
  • Complete keyboard shortcuts and frame focus stuff for speedy use
  • No GUI option. eg: "# webpic.pl -nogui -scale 20% -dir /var/www/images -newdir pr0n" etc
  • add the option to not have descriptions (no gui mode only?)
  • thinking about a slideshow html style
  • Need to add html bg and font colors to the option
Generic Registry Editor
on Jun 22, 2001 at 23:19 UTC
by ralfthewise
The is a gui driven registry editor for network admins. It allows admins to create standard registry edits for workstation builds, maintenance, etc.
monitor.pl
on Jun 06, 2001 at 01:12 UTC
by xphase_work
A simple system monitor written in Tk, should be
cross-platfrom, but only tested on Solaris 2.7.
This is my first somewhat large app in Perl/Tk.
Any comments would be helpful.
pVoice
on May 29, 2001 at 15:13 UTC
by Jouke
pVoice is a speechapplication for disabled people who can't speak themselves. By only generating left and right mousebuttonclicks the whole application can be operated.

update: pVoice has grown so much that it's not possible to keep the code here updated. You can find the sourcecode of pVoice 2.x at opensource.pvoice.org. Binary releases (packed with ActiveState's PerlApp) can be found on www.pvoice.org.
The current pVoice does no longer use Tk for the GUI, but wxPerl instead

I'll keep the code updated in here, though pVoice 0.01 was posted in Cool Uses for Perl. For more backgroundinfo, look at http://www.pvoice.org

This is version 0.02.1
The current version is 2.1
Pic Thresher
on Feb 24, 2001 at 08:34 UTC
by ichimunki
Assists in rapidly sorting and "threshing" a heap of JPGs. Requires an RDBMS (set to postgreSQL, but easily changed) and Tk.

Images and RDBMS not included. :)
Module info viewer
on Feb 19, 2001 at 20:18 UTC
by TheoPetersen
Show module versions for a running program.

I wrote this window to help with debugging mysterious failures at customer sites. We send scripts and modules to our users, who install them locally. They also install updates from CPAN as recommended, but we sometimes find we are out of sync. This code can be added to any Perl/Tk program to bring up a window which displays the versions of all modules loaded by the program to that point. The information is displayed in a Text widget, which allows the user to cut and paste it easily into a mail message.

The enclosed wrapper program is trivial but serves as an example framework. I cut and pasted it from one of our apps (and noticed the old-style Frame menu bar along the way, hmmm). On re-reading I think the code that gets the version data is rather clunky; any suggestions?

gPOD
on Jan 04, 2001 at 22:05 UTC
by KM
As an exercise to do some Perl/Gtk+ without using Glade, I decided to create a Gtk+ POD viewer, gPOD. I have been using it for the last few days, and actually kind of like it, so I thought I would share. I have a growing TODO list for it (adding color text, saving as things other than text, saving prefs, etc...) so if you happen to use it, and like it let me know so I can give you updates.
So, use it, abuse it, give me some comments (here or email), suggestions, patches, screenshots, etc.. I plan to continue to work on this and build a decent app.

So far, I have only tested this with Gtk 1.2.8/Gtk-Perl 0.7004, and Helix Gnome.

process_killer.pl
on Dec 25, 2000 at 00:30 UTC
by Falkkin
process_killer.pl is a graphical process-management program. It uses the Tk module for GUI and currently delegates to the system's "ps" and "kill" commands for actual process management. It supports the signals TERM, STOP, CONT, INT, HUP, and KILL (if your system supports them all.)

In its current configuration, it runs on my Debian GNU/Linux box; others may have to tweak it slightly to get it to work on their machines. Check the source for more info. If there is any demand for a more portable version of this program, I'll work on it.

The latest version of this program, along with a screenshot and other information, will always be available at http://www.jenovaproject.org/software/process_killer/.

Update: somehow, the code I had posted here didn't make it to the page; I've re-added the code, so go ahead and take a look at it.

Gtk+ HTML Tree Viewer
on Sep 20, 2000 at 21:17 UTC
by mdillon

this is a rewrite of a utility i did for a job where i was using HTML::TreeBuilder and XML::XPath to parse and search normal HTML documents using the powerful XPath query language.

this utility uses HTML::TreeBuilder to parse an HTML document from a URL specified on the command line or from an internal browser location line and displays it as a Gtk+ Tree in a window. only subtrees with text nodes or anchors are expanded.

there are (simple) XPath queries displayed in the status bar that could be used to extract that node from the document (for example, by converting it to XHTML with HTML::TreeBuilder and then using XML::XPath, or by traversing the TreeBuilder parse tree and programmatically constructing an XPath parse tree).

it's probably not a bad example of simple Gtk+ GUI programming. more may be yet to come in the way of functionality (and comments).

this was written and tested against Gtk 0.7003.

there is support for using GtkHTML as well, if your installation is functional (mine was partially functional when i wrote the code, but stopped working after i upgraded from GtkHTML 0.4 to 0.6.1 and recompiled Gtk::HTML)

most recently updated: 24 Sep 2000

Webcam 0.2
on Jul 08, 2000 at 01:35 UTC
by Arjen
I created this program when I still lived back in the netherlands. I had a Webcam-II hooked up to my Linux machine and at that time there were not many good programs for webcams, so I created my own.

This program uses Stamp and vidcat as utilities to capture and textstamp the picture.

My original page for links to the above programs.

Cheers
finddata.pl
on May 31, 2000 at 20:45 UTC
by perlcgi
This cool utility is included as a mini-demonstation of
what is possible with Perl on Win32 using Win32::GUI.
This code, the associated database and bitmap may be downloaded from here
If anyone can figure out why the "Stop" button does not
work properly or how to read the individual items of each
column based on the index item clicked on then Jonathan would appreciate the input.
Also Jonathan will be happy to answer anybody's questions
about the code if he can.
"It was done on a trial and error basis ... definitely not written off the cuff and then worked properly.
It required some rewrites of course. ;] Anyway, have fun with the code and any experimenting you want to do on it."
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (18)
As of 2014-09-22 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (195 votes), past polls