title: Perl Tkx, What is the Difference Between "button" and "ttk__button"?
body: <p>I have been working on a GUI using Perl Tkx, and discovered that there are two separate functions you can use to create buttons. (<code>button</code> and <code>ttk__button</code>).</p>
  
  <p>So far the only difference I found is that the <code>button</code> function appears to center justify the text while the <code>ttk__button</code> function appears to left justify the text.</p>
  
  <hr>
  
  <p>Example using <code>button</code>:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  
  use Tkx;
  
  my $text = "Hello\nworld!\n\nThis is some text...";
  my $mw = Tkx::widget-&gt;new(".");
  
  my $b = $mw-&gt;new_button(
      -text =&gt; $text,
      -command =&gt; sub { exit; },
  );
  $b-&gt;g_grid;
  
  Tkx::MainLoop()
  </code></pre>
  
  <p>This script will center the text:</p>
  
  <p><img src="https://i.stack.imgur.com/O7jlE.png" alt="Centered text"></p>
  
  <hr>
  
  <p>Example using <code>ttk__button</code>:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  
  use Tkx;
  
  my $text = "Hello\nworld!\n\nThis is some text...";
  my $mw = Tkx::widget-&gt;new(".");
  
  my $b = $mw-&gt;new_ttk__button(
      -text =&gt; $text,
      -command =&gt; sub { exit; },
  );
  $b-&gt;g_grid;
  
  Tkx::MainLoop()
  </code></pre>
  
  <p>This script will left justify the text:</p>
  
  <p><img src="https://i.stack.imgur.com/u32Kl.png" alt="Left justified text"></p>
  
  <hr>
  
  <p>I was wondering what other differences there are between these two functions and whether there is any particular reason there are two separate functions that create buttons.  Is one of these typically better to use than the other?</p>
  
  <p>Also is there any way to center justify the text using the <code>ttk__button</code> function?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I added the "Tcl" tag to this since Perl Tkx is essentially built off of Tcl.  I'm pretty good with Perl but I am somewhat of a novice when it comes to Tcl.</p>
  
  <p>Although it may not seem like it at first glance, this is actually more of a Tcl question than a Perl question so I would love to hear an answer from someone who is experienced with Tcl.</p>
  
  <hr>
  
  <p><strong>NOTE:</strong></p>
  
  <p>To center text in a <code>ttk__button</code> add the following line to your code:</p>
  
  <p><code>Tkx::ttk__style_configure('TButton', -justify =&gt; 'center');</code></p>