- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在尝试使用 Tkx 创建 Perl GUI,但遇到了几个问题。
我一直在看这些网站:
http://rainbow.ldeo.columbia.edu/documentation/tkperl/
http://docs.activestate.com/activetcl/8.5/tcl/tk_contents.htm
http://www.tkdocs.com/tutorial/onepage.html
但问题是这些示例似乎对我不起作用。
我想尽可能多地使用面向对象的方法,但不使用 moose(暂时),这样我就可以了解对象在 Perl 中的工作方式。
编辑:link一个好的 oo 教程
所以我已经可以创建一个窗口了:
sub main
{
my $mainWindow = Tkx::widget->new(".");
$mainWindow->g_wm_title("FixViewer");
$mainWindow->g_wm_minsize(400,500);
Tkx::MainLoop();
}
如何创建框架并在其上放置网格布局?
谁能告诉我怎么做,或者给我一个好的教程的链接。
谢谢
use strict;
use warnings;
use Tkx;
sub main
{
my $mainWindow = Tkx::widget->new(".");
$mainWindow->g_wm_title("FixViewer");
$mainWindow->g_wm_minsize(100,100);
my $contentFrame = $mainWindow->new_ttk__frame(-padding => "3 3 12 12");
$contentFrame->g_grid(-column => 0, -row => 0, -sticky => "nwes");
$mainWindow->g_grid_columnconfigure(0, -weight => 1);
$mainWindow->g_grid_rowconfigure(0, -weight => 1);
my $input;
my $output;
#create a textbox where user can enter input
my $inputbox = $contentFrame->new_ttk__entry(-width => 7, -textvariable => \$input);
$inputbox->g_grid(-column => 1, -row => 1, -sticky => "we");
#create a lable which shows whatever is input in the input box
my $inputlabel = $contentFrame->new_ttk__label(-textvariable => \$output);
$inputlabel->g_grid(-column => 1, -row => 2, -sticky => "we");
#create a button and bind a sub to it
my $button = $contentFrame->new_ttk__button(-text=> "Click me",-command=> sub {dostuff(\$output,\$input);} );
$button->g_grid(-column => 1, -row => 3, -sticky => "w");
#bind return key to method, so method will get called when key is hit
$mainWindow->g_bind("<Return>",sub {dostuff(\$output,\$input);});
Tkx::MainLoop;
}
sub dostuff
{
my $output = shift;
my $input = shift;
$$output = $$input;
}
#############
# Call main #
&main();
#############
我设法想出了一些东西。仍然非常欢迎更多示例或教程链接
最佳答案
my $contentFrame = $mainWindow->new_ttk__frame(-padding => "3 3 12 12");
$contentFrame->g_grid(-column => 0, -row => 0, -sticky => "nwes");
$mainWindow->g_grid_columnconfigure(0, -weight => 1);
$mainWindow->g_grid_rowconfigure(0, -weight => 1);
关于Perl Tkx 示例或教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16853122/
我一直在尝试使用 Tkx 创建 Perl GUI,但遇到了几个问题。 我一直在看这些网站: http://rainbow.ldeo.columbia.edu/documentation/tkperl/
有没有人知道用 TKX 制作的 GUI 的好 IDE?像 NetBeans 或 VS 这样的拖放功能会很好。 最佳答案 “SpecTcl 是 Tcl/Tk 的 WYSIWYG GUI 构建器,具有用于
我正在使用 Perl Tkx 制作一个简单的应用程序,并允许用户选择一个目录。如果名称太长,我想截断它并将“...”附加到末尾,而不是使用文本换行或将框拉伸(stretch)到荒谬的长度来显示整个目录
我正在开发一个 Perl Tkx 应用程序,但无法获取有用/正确的错误消息。我正在尝试使用 croak,所以它会准确地告诉我失败的位置,但每次它发出 croak 时,它只会说错误位于“C:/Perl6
我一直在使用 Perl Tkx 开发 GUI,并发现有两个独立的函数可以用来创建按钮。 (button 和 ttk__button)。 到目前为止,我发现的唯一区别是 button 函数似乎使文本居中
我发现在为 Tkx 小部件指定 -command 参数时必须匿名包装定义的子例程有点奇怪。 摘自 TkDocs tutorial证明了这一点: my $cb = $frm->new_ttk__butt
我试图使用 Perl Tkx 创建一个窗口,其中包含一个 TreeView 小部件和一个位于其右侧的滚动条。我需要 TreeView 小部件在用户调整窗口大小时自动调整大小。 这是我的: my $mw
这是我的规范:OS X 老虎珀尔5.8使用与 ActiveTcl v8.5 捆绑在一起的 Tkx 我已经使用 PAR/pp 成功创建了具有上述配置的独立应用程序,但这并不是一个完全令人满意的解决方案:
为了在 Ubuntu 14.04 上安装一个名为 PrimerMapper 的包来设计引物,我需要安装一个名为 的 perl 模块。短信 但在安装时遇到麻烦。所以,请帮助我解决这个错误。 为了您快速方
我有一个非常大的旧 Perl Tk GUI 应用程序,我正在将其重构为 Tkx。我想将界面分成几个包,这样我就可以以模块化的方式构建应用程序 UI。此外,我希望将 View 与模型分开,使用 Cont
我真的很喜欢Perl/Tk ,但已经得出的意见认为它是 DOA。我认为 Tcl::Tk和 Tkx是更好的解决方案。假设我放弃 Perl/Tk . Tcl::Tk 是“最受支持”的路线吗? (自 200
我是一名优秀的程序员,十分优秀!