- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
编译 TCL/Tk 时 manually from sources或者只是 install it from ActiveState您在 TCL/Tk 安装文件夹中获得以下结构:
+- bin
+- tcl85.dll
+- tk85.dll
//...
+- lib/
+- tcl8.5/
//All TCL files (.tcl)
+- tk8.5/
//All TK files (.tcl)
//...
因此,当您编译您的某些应用程序并将其链接到 TCL 和 TK DLL 时,DLL 会在相对于(DLL 的)目录 ../lib/tk8.5 和 ../lib 中搜索所有 TCL/TK 文件/tcl8.5。这使得在不必让最终用户安装 TCL 和 TK 的情况下分发您的应用变得相当困难。
我想分发我的 C++ 应用。
我使用 CPPTK默认 GUI 布局。
我想让最终用户不需要安装 TCL 和 TK。我想为他们提供包含 TK 和 TCL .TCL
源文件的文件夹,这些文件将位于与我的应用相关的某个目录中,例如 extras/TCL
和 extras/传统知识
。如何告诉 TK 和 TCL DLL 源文件文件夹在哪里?这样做的 TK 和 TCL API 函数名称是什么?是否有任何特殊的 cpptk 函数?
更新所以我尝试了 Donal Fellows answer具有下一个文件夹结构。
app/
+- app.exe
+- tcl85.dll
+- tk85.dll
+- extras/
+- tcl/
//All TCL files you can find in TCL install folder/ lib/tcl8.5
+- tk/
//All TK files you can find in TCL install folder/ lib/tk8.5
我的代码是这样的:
#include <stdio.h>
#include "cpptk/cpptk.h"
using namespace Tk;
int main(int, char *argv[])
{
static char* str = "set extrasDir [file dirname [info nameofexecutable]]/extras\n"
"# Now use it to load some code...\n"
"source $extrasDir/tcl/init.tcl\n"
"# Another way to load code, using all *.tk files from a directory:\n"
"foreach tkFile [glob -nocomplain -directory $extrasDir/tk *.tk] {\n"
" source $tkFile\n"
"}\n";
// This next part is in a function or method...
//std::string script("the script to evaluate goes here");
std::string result = Tk::details::Expr(str,true); // I think this is correct
std::cout<< result << std::endl;
std::cin.get();
Tk::init(argv[0]);
button(".b") -text("Say Hello");
pack(".b") -padx(20) -pady(6);
Tk::runEventLoop();
std::cin.get();
}
它编译但在 cpptkbase.cc 的第 36 行失败
顺便说一句:我用了 this html\js app to get char string.
最佳答案
如果您有一个包含您的二进制文件的目录,并且您想要找到相对于它的那些 Tcl 文件,如下所示:
yourapp1.0/ +- yourapp.exe +- extras/ +- tcl/ +- foo.tcl +- bar.tcl +- tk/ +- grill.tk
Then you can write Tcl code to find those scripts. That code would be like this:
set extrasDir [file dirname [info nameofexecutable]]/extras
# Now use it to load some code...
source $extrasDir/tcl/foo.tcl
source $extrasDir/tcl/bar.tcl
# Another way to load code, using all *.tk files from a directory:
foreach tkFile [glob -nocomplain -directory $extrasDir/tk *.tk] {
source $tkFile
}
如果您使用脚本作为您的主程序,但在上述结构中进行了其他设置,您将使用 $argv0
(一个特殊的全局变量)而不是 [信息名称可执行文件]
。或者可能是 [info script]
(尽管有一些注意事项)。
[编辑]:要使该代码与 C++/Tk 一起工作,您需要更加巧妙。特别是,您需要访问一些额外的内容:
#include "cpptk.h" // might need "base/cpptkbase.h" instead
#include <string>
// This next part is in a function or method...
std::string script("the script to evaluate goes here");
std::string result = Tk::details::Expr(script,true); // I think this is correct
我应该警告说,我不经常编写 C++,所以这很有可能行不通;它只是基于阅读 C++/Tk 源代码并进行猜测。 买者自负。
关于c++ - 如何告诉TCL和TK在本地搜索默认 `.tcl`语言文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6553232/
我想向 tk.Tk 和 tk.Toplevel 的实例添加 2 个方法。前者作为应用程序根窗口存在,后者由用户创建任意次数。每个 tk.Toplevel 代表应用程序的不同功能,目前有 13 种变体。
尝试创建 Listbox 的子类,以便我可以创建一个新的 KeyListbox from tkinter import * class KeyListbox(Listbox): def __
以下是错误: $ perl ftper.plUse of uninitialized value $id in hash element at /usr/lib/perl5/vendor_perl/5
我正在尝试使用 tk.Scale 来更改 tk.IntVar。我可以在第一个 tk 窗口上执行此操作,但不能在第二个窗口上执行。为什么? 看看这个可怜的样本: import tkinter as tk
我输入了我的框架比例,但我不确定如何在我的标签中显示这个比例的值。每次秤移动时我都需要更新它。我怎样才能做到这一点? self.options_settings.framepripojeni6 = F
这个video向我介绍了 X 的问题以及 Wayland 协议(protocol)的替代方案。多年来,Wayland 协议(protocol)的采用似乎在不断增长。 我的问题: tkinter 和 t
这些天我经常看到这一行:tk.Tk.__init__(self,*args,**kwargs)并且不明白它的用途。我的问题不是 *args 和 **kwargs)。 例如,在此处的这些代码行中: cl
这个问题涉及Python和Tkinter。 我想同时使用两个不同的 ttk 主题,例如一个 Tkinter 窗口中的“clam”和“vista”。所以我写了这个: import tkinter as
从 Tk 8.5 开始,Tk 开始使用基于原生的 UI 组件——按钮、滚动条等。我想知道 C++/Tk 是否支持这种原生 GUI 方法? 最佳答案 据我所知,C++/Tk 是基于 Tk 8.4(如果是
我无法让 ruby 成功地 require 'tk'。我正在使用 rvm、ruby 2.0.0、ActiveTcl-8.6 和 Ubuntu 12.04 LTS。我已经运行了随 ActiveTcl
我想用最有效的方式来限制用户不输入数字以外的任何内容。例如:当他们在条目中输入字母时,该条目将被清除。有没有什么方法可以用最少的结构改变来做到这一点? 这是我的代码:[??????标志是我被困的地方]
我真的很喜欢Perl/Tk ,但已经得出的意见认为它是 DOA。我认为 Tcl::Tk和 Tkx是更好的解决方案。假设我放弃 Perl/Tk . Tcl::Tk 是“最受支持”的路线吗? (自 200
我正在尝试使用 perl:latest 和 activestate/circleci-activeperl:latest 图像在 ubuntu:16.04 容器上运行使用 Tk 模块制作的简单 per
我曾经使用 tk.Scale 的 digits 属性来确保 Label 或 Spinbox 中的数字> 在 slider 移动时显示固定的小数位数。比如 3.456, 4444.567, 555555
问题就在标题中,本质上是:如何在设置 Entry 的 textvariable 后继续调用 validatecommand 回调?这是最低工作示例 (MWE): import tkinter as t
在Perl/Tk应用程序中,我想将带有任意Unicode文件名的文件拖放到小工具上。。有一个正在运行的DropSite示例:Windows资源管理器中的perl tk拖放文件夹,但它不能处理包含Uni
我在 macOS BigSur 上通过 VMWare 使用 Ubuntu 20.04.2 LTS。我安装了最新版本的 tcl、tcl-dev、tk 和 tk-dev - 版本 8.6。我想编译 Arc
我组装 Tk 窗口的方式有问题(在 Win XP 下使用 R tcltk 和 tcltk2) library(tcltk) library(tcltk2) expandTk <- function()
我想在 Textdocument 的特定行中写入,但我的代码有问题,我不知道错误在哪里。 set fp [open C:/Users/user/Desktop/tst/settings.txt w]
当在 TK 中创建新的顶层或按钮时,需要输入路径名。我看过一个基本代码,如下所示: toplevel .a ... button .a.b ... 我的问题是:点与字母的处理方式是否不同?它们是某种创
我是一名优秀的程序员,十分优秀!