I am making an "all-in-one calculator" (I guess). Here is my code (I know I do not have all subroutines defined, I'm still working on this as you can see):
use 5.12.4;
use warnings;
use Tk;
##### Create MainWindow #####
my $button_menu = new MainWindow;
#############################
##### MainWindow Buttons#####
my $calculator_button = $button_menu->Button(-text=>"Calculator",
-width=>10,
-relief=> 'raised',
-command=>\&open_calculator)->pack();
my $formulas_button = $button_menu->Button(-text=>"Formulas",
-width=>10,
-relief=> 'raised',
-command=>\&open_formulas)->pack();
my $lcf_button = $button_menu->Button(-text=>"Find LCF",
-width=>10,
-relief=> 'raised',
-command=>\&open_lcf)->pack();
my $gcf_button = $button_menu->Button(-text=>"Find GCF",
-width=>10,
-relief=> 'raised',
-command=>\&open_gcf)->pack();
#############################
sub open_calculator{
system(qq{start "C:\\Windows\\system32\\calc.exe"});
}
MainLoop;
Why does the system function not open the Windows calculator? Also, is there any source code I could use to make a basic calculator in Tk?
Thanks!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|