Games:...g2TkPs(3pm)
π Games:...g2TkPs π
okay bestie so this is a page from the User Contributed Perl Documentation collection, and it's about Games::Go::Sgf2Dg::Dg2TkPs, which is a whole mouthful, i know. it's a Perl module, it lives in the 3pm section, and it's giving "i was thrown together in an afternoon and i know it." π«Ά
β¨ NAME β¨
Games::Go::Sgf2Dg::Dg2TkPs β the module that converts Games::Go::Sgf2Dg::Diagrams to PostScript, straight out of a Tk window. π
πΈ SYNOPSIS πΈ
here's the whole vibe, copy-paste ready:
use Games::Go::Sgf2Dg::Dg2TkPs
my $dg2ps = B<Games::Go::Sgf2Dg::Dg2TkPs-E<gt>new> (options);
my $canvas = $dg2ps->convertDiagram($diagram);
π¦ DESCRIPTION π¦
ngl bestie, this is a real hack. like, the whole entire point is to get PostScript output out of the Dg2Tk converter, and all it actually does is lean on the built-in PostScript that a Tk::Canvas widget already hands you, then use that to convert the Dg2Tk canvas pages into PostScript. that's it. that's the trick. π
so obviously the resulting PostScript is fairly crude β because the Canvas it's drawn from was crude to begin with. it's giving "we worked with what we had." if you want a better PostScript converter, go look at Games::Go::Sgf2Dg::Dg2Ps instead, that one's the main character. π
a Games::Go::Sgf2Dg::Dg2TkPs inherits from Games::Go::Sgf2Dg::Dg2Tk, and it uses all of its methods and options. the main difference is that once the conversion to Tk is done, each diagram Tk::Canvas gets converted to PostScript via the Tk::Canvas->postscript method. then some minor massaging of the PostScript source happens, to string all the canvas pages together. slay. β¨
π METHODS π
for the usual Dg2* conversion methods, go peek at Dg2Tk β that's where the classics live. the ones specific to this module are:
$dg2ps->comment ($comment ? , ... ?)β drops comments into the PostScript source code. but heads up π¨ because the PostScript only gets generated after all the diagrams are constructed byDg2Tk, the comments are likely to be out of order β they'll all end up sitting at the head of the PostScript file. iconic placement, honestly.$dg2ps->configure (option => value, ?...?)β grabs the'file'configuration option for itself, and passes every other request straight through toDg2Tk. teamwork π«Ά$dg2ps->closeβ converts each diagramTk::Canvasin theDg2TkNoteBook to PostScript, via theTk::Canvas->postscriptmethod. the grand finale. π
π SEE ALSO π
sgf2dg(1)β Script to convert SGF format files to Go diagrams. the OG tool. iykyk. β
π BUGS π
okay so the output is pretty ugly. fr fr. that's just... what it is. oh well β what can you expect from such a simple hack? π
bestie, if you're here for pretty PostScript, you're in the wrong repo. no cap.
and that's the whole page π β this was perl v5.30.0, dated 2019-10-27, and the page itself goes by Games:...g2TkPs(3pm). mwah, go forth and convert some diagrams, queen π§πΈ
π¦ where this page comes from
- debian bookworm: sgf2dg 4.252-1
- debian trixie: sgf2dg 4.252-1
- ubuntu jammy: sgf2dg 4.252-1
- ubuntu noble: sgf2dg 4.252-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms