HDF5::tkview(3pm)

πŸ’– NAME πŸ’–

PDL::IO::HDF5::tkview β€” peep your HDF5 files with the perl/tk and PDL::IO::HDF5 modules, bestie πŸ’…

(It lives in the HDF5::tkview(3pm) corner of the User Contributed Perl Documentation, iykyk.)


✨ DESCRIPTION ✨

Okay so, real talk: this is an experimental object for viewing HDF5 files with the PDL::IO::HDF5 module. It's giving tree view energy. The HDF files get displayed in a tree structure using Tk::Tree. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

use Tk;
use PDL::IO::HDF5::tkview
use PDL::IO::HDF5;

my $mw = MainWindow->new;

my $h5 = new PDL::IO::HDF5('datafile.h5');  # open HDF5 file object

my $tkview = new PDL::IO::HDF5::tkview( $mw, $h5);

MainLoop;
bestie the missing semicolon on that use line is literally in the original, I'm not touching it, it's iconic. πŸ’€

πŸ‘‘ MEMBER DATA πŸ‘‘

mw

Tk window where the file structure is displayed. 🫢

H5obj

PDL::IO::HDF5 Object. slay.

hl

Tk Hlist object. ✨

dataDisplaySub

Sub ref to execute when a dataset is double-clicked. This defaults to a print of the dataset. See dataDisplaySubSet for details. 😌

Tk Hlist object

ngl that second line is just there in the original, so it's here too. We don't question the ancients. 🧚

πŸ’… METHODS πŸ’…

🌸 new

PDL::IO::HDF5::tkview Constructor - creates new object. The main character moment. ⭐

Usage:

$tkview = new PDL::IO::HDF5::tkview( $mw, $H5obj);

   Where:
       $mw     Tk window
       $H5obj  PDL::IO::HDF5::Object

🌸 dataDisplaySubSet

Set the dataDisplaySub data member. Lowkey the glow-up button for your double-click behaviour. πŸ”₯

Usage:

# Data Display sub to call when a dataset is double-clicked
my $dataDisplay = sub{ my $data = $_[0]; print "I'm Displaying This $data\n";};
$tkview->dataDisplaySubSet($dataDisplay);

The dataDisplaySub data member is a perl sub ref that gets called when a dataset is double-clicked. Bestie, it starts out set to just print the dataset's data to the command line. But with the dataDisplaySubSet method, you can "plug-in" totally different actions for displaying the data. Mix and match, it's your world. πŸ’–

🌸 activateCmd

Internal Display method invoked whenever a tree element is activated (i.e. double-clicked). This method does nothing unless a dataset element has been selected. It that cases it calls $self->dataDisplaySub with the data.

fr fr, hand it a non-dataset and it's just standing there, serving absolutely nothing. πŸ«₯

and that's the whole page, periodt. πŸ’œ This absolute gem of a doc shipped as part of Perl v5.42.3, dated 2026-08-21 β€” written in the holy scripture of perl v5.42.3, 2026-08-21, and HDF5::tkview(3pm). go read your HDF5 files, bestie, you ate. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from