Games::Go::Sgf2Dg::Dg2Tk - convert Games::Go::Sgf2Dg::Diagrams to
perl/Tk windows
use Games::Go::Sgf2Dg::Dg2Tk
my $dg2tk = B<Games::Go::Sgf2Dg::Dg2Tk-E<gt>new> (options);
my $canvas = $dg2tk->convertDiagram($diagram);
A Games::Go::Sgf2Dg::Dg2Tk object converts a
Games::Go::Sgf2Dg::Diagram object into Tk::Canvas item. The close
method calls Tk::MainLoop to dispays the collection of Canvases.
Bindings for the normal editing keys: Up, Down, Next (PageDown)
and Prior (PageUp) traverse the NoteBook tabs. Tab and Shift-tab also work
as expected.
Left and Right keys select the previous or next NoteBook tab, but
don't display it. Space and Enter (carriage return) display the selected
tab.
- $dg2tk->configure (option => value, ?...?)
- Change Dg2Tk options from values passed at new time.
- my $coord =
$dg2mp->diaCoords ($x, $y)
- Provides access to the diaCoords option (see above). Returns
coordinates in the converter's coordinate system for board coordinates
($x, $y). For example, to get a specific
intersection structure:
my $int = $diagram->get($dg2mp->diaCoords(3, 4));
- $dg2tk->print ($text ? , ... ?)
- For most Dg2 converters, print inserts diagram source code (TeX,
ASCII, whatever) directly into the diagram source stream. Since Tk
displays the diagrams immediately, there is no concept of a source stream,
so print just generates a warning.
- $dg2tk->printComment ($text ? , ... ?)
- Adds $text to the diagram comments.
- $dg2tk->comment ($comment ? , ... ?)
- For most Dg2 converters, comment inserts comments into the diagram
source code (TeX, ASCII, whatever). Since Tk displays the diagrams
immediately, there is no concept of a source stream, so comment
does nothing.
- my $canvas =
$dg2tk->convertDiagram ($diagram)
- Converts a Games::Go::Sgf2Dg::Diagram into a Tk::Canvas widget.
Returns a reference to the Canvas. The Canvas is also added to the
Tk::NoteBook collection of diagrams that are displayed (at close
time).
- my $converted_text =
$dg2tk->convertText ($text)
- Converts $text into text for display - gee, that's
not very hard. In fact, this method simply returns whatever is passed to
it. This is really just a place-holder for more complicated converters.
Returns the converted text.
- $dg2tk->close
- prints any final text to the diagram (currently none) and closes
the dg2tk object. Also closes file if appropriate.
- $dg2tk->notebook
- Returns a reference to the notebook of Tk::Canvas objects.
- $dg2tk->diagrams
- Returns a reference to the list of Tk::Canvas objects that make up the
Tk::NoteBook of diagrams. Note that each item in the list is actually a
Tk::Scrolled object, the actual Tk::Canvas object is:
my $canvas = $dg2tk->diagrams->[$idx]->Subwidget('scrolled');
- sgf2dg(1)
- Script to convert SGF format files to Go diagrams
We ain't got to show you no stinkin' bugs!