tk

tcl/tk编译

天大地大妈咪最大 提交于 2020-01-12 19:05:23
参考: http://www.tcl.tk/doc/howto/compile.html#win 可下载已编译好的bin版本: https://bitbucket.org/tombert/tcltk/downloads/ 1.下载tcl-tk库 http://www.tcl-lang.org/ https://nchc.dl.sourceforge.net/project/tcl/Tcl/8.6.10/tcl8610-src.zip https://nchc.dl.sourceforge.net/project/tcl/Tcl/8.6.10/tcl8610-src.zip 2. 将下载后的文件解压到如下目录 E:\osg\tcl-tk\tcl8.6.10 与 E:\osg\tcl-tk\tk8.6.10 并创建如下目录: E:\osg\tcl-tk\tcltk 3. 编译 打开X64 Native Tools Command Prompt for VS 2019程序 3.1 TCL cd E:\osg\tcl-tk\tcl8.6.10\win nmake -f makefile.vc INSTALLDIR=E:/osg/tcl-tk/tcltk nmake -f makefile.vc install INSTALLDIR=E:/osg/tcl-tk/tcltk 3.2 TK cd

How to save text from a Text-widget Tkinter to a .doc using asksaveasfile?

…衆ロ難τιáo~ 提交于 2020-01-11 13:54:48
问题 I want to save some stuff I entered in a Text widget to a .txt or .doc format, using an asksaveasfilename dialog box. After this I want it to open in resp. Notepad or MS Word. from tkFileDialog import asksaveasfilename import os.path name = asksaveasfilename( initialdir="dir", title="Save as", filetypes=[("Text files",".txt"),("Word files",".doc")]) data = open(name,"w") data.write("text from text widget") os.startfile(name) It creates the file but it won't open it in MS Word or Notepad.

订单查询api(淘宝)

三世轮回 提交于 2020-01-11 01:21:25
接口变更说明: 变更说明: 将原接口中的订单列表移到了list下,将list字段放在data列表下,并将原接口中的订单位点、页码、每页数量等数据一起放到data列表下,与list同层级。 订单数据格式: 原订单数据格式: {"code": 200,"data": [{"adzone_id": "xxxx","adzone_name": "test","alimama_rate": "0.00","alimama_share_fee": "0.00","click_time": "2019-05-15 18:23:26","flow_source": "--","income_rate": "4.50","item_category_name": "食品-零食/特 产","item_id": "xxxx","item_img": "//img.alicdn.com/bao/uploaded/i2/628189716/O1CN01leSoTT2xxxxxxx53dJ_!!0- item_pic.jpg","item_link": "http://item.taobao.com/item.htm?id=xxxxxx","item_num": "1","item_price": "59.80","item_title": "休闲零 食小吃整箱","order_type": "聚划算",

ubuntu matplotlib 图像显示问题  No module named _tkinter

让人想犯罪 __ 提交于 2020-01-09 19:04:37
ubuntu matplotlib 图像显示问题 import matplotlib.pyplot as plt year = [2011,2012,2013,2014] pop = [1.2,3.4,4.5,6.5] 会抛出如下错误 ImportError: No module named _tkinter, please install the python-tk package 解决步骤 sudo apt-get update 观察python的小版本号 然后对应的写成版本号的 python2.7-tk 的命令 sudo apt-get install python2.7-tk 完美解决,图像出来了 来源: CSDN 作者: 成伟Frey 链接: https://blog.csdn.net/fanchw/article/details/103910134

用Tcl/Tk脚本计算圆周率

你说的曾经没有我的故事 提交于 2020-01-09 17:29:37
读了阮一峰的 蒙特卡罗方法入门 ,用概率统计的方式求解棘手的数学问题还挺有意思的,尤其是利用正方形和它的内切圆之间的面积关系来建模求解圆周率的方法精巧又简单,比投针实验好理解也好实现多了。建模可不是Matlab或者MAST/VHDL语言的专利,既然tcl/tk语言也有内置的随机数产成函数 rand() ,那么我用tcl/tk建模计算圆周率也应该不在话下。 建模思想 正方形的内切圆与该正方形的面积之比是π/4。 图片和公式引用自阮一峰的 蒙特卡罗方法入门 在这个正方形内部,随机产生足够多的点,计算它们与中心点的距离,判断是否落在圆的内部。如果这些点均匀分布,那么圆内的点应该占到所有点的 π/4,因此将这个比值乘以4,就是π的值。 脚本实现 tcl/tk内置math函数库的rand()方法可以随机生成0~1的浮点数,假设圆的半径为整数r,可以用以下方式产生(0,r)区间的随机整数: set value [ int [ expr rand () * $r ]] 为了计算简便,可以把模型进一步简化,只计算第一象限内的点落入圆内的比例。为了观察tcl/tk的 rand() 函数是否真的随机,我又多加了几行tk代码,把所有的点都显示出来。下面的代码中正方形的边长为300,随机产生300*300个点,理想情况下如果随机点100%均匀分布,那么每个点应该恰好对应一个像素,画布会一片漆黑。 tcl

Color of Radiobutton in Tcl/Tk 8.5

这一生的挚爱 提交于 2020-01-06 07:09:28
问题 is it possible to modify the color of a radiobutton's dot (i.e. only the fill-color of the diamond/circle)? I am already using the classic theme, in order to get the old diamonds. But unfortunately, the fill-color of those diamonds is always some red and I need bright green. Is that possible? Maybe by creating an own widget that "inherits/extends" the basic radio button? Any kind of advice is welcome. Kind regards, mefiX 回答1: The radiobutton command has -selectcolor option. Just specify the

How to set Tcl/Tk “system configuration” items?

牧云@^-^@ 提交于 2020-01-06 06:33:07
问题 https://www.tcl.tk/man/tcl8.6/TkCmd/tk_mac.htm#M20 talks about a "System configuration parameter", which is supposed to modify toplevel background on Mac. How should I set this parameter in Tkinter? I tried tk_root.option_add("::tk::mac::useThemedToplevel", 1) but it seems to have no effect. 回答1: I believe that was for MacOS, last released in 1999. When using the 'aqua' theme on Mac OS X, the theme colors can't be changed. If you need to have a changeable color, use the older widgets, 'frame'

How to have an L shaped layout with pack?

廉价感情. 提交于 2020-01-06 04:31:12
问题 I have: try: # In order to be able to import tkinter for import tkinter as tk # either in python 2 or in python 3 except ImportError: import Tkinter as tk if __name__ == '__main__': root = tk.Tk() rgb = {'red', 'green', 'blue'} frames = dict() for color in rgb: frames[color] = tk.Frame(root, height=64, width=64, bg=color) frames['red'].grid(row=0, column=0) frames['green'].grid(row=1, column=0) frames['blue'].grid(row=1, column=1) root.mainloop() which uses grid for its layout. How can I have

Tcl/Tk Tkinter version 8.4 and 8.5 conflict on Mac Os X 10.4.11 with python 2.6.4

岁酱吖の 提交于 2020-01-05 10:27:32
问题 I am having trouble getting Tkinter up and runnning in order to install matplot lib. I am running Mac OS X 10.4.11, and just installed Python 2.6.4 . After several other fights, one remaining battle for me to get matlotlib installed is to have a working version of Tkinter, although there are several in my Mac from Xcode and also Python, I guess they just aren't installed in useful places? After I installed Python 2.6.4, import _tkinter failed. So I installed Tcl 8.5 from active state. Now, I

closing tkmessagebox after some time in python

烈酒焚心 提交于 2020-01-03 16:52:22
问题 I am developing an automated attendance system where when a student scans his RFID tag, his attendance is recorded while showing a welcoming message using a tkmessagebox pop-up. The user will not have control of a mouse or keyboard and I would like to keep the message showing for 2 seconds and delete the message box. Is there a way I can close the tkmessagebox pop-up like proposed? 回答1: I don't think that it can be done with tkMessageBox because this creates a modal dialog, and you do not