tk

Ruby require 'tk' yields LoadError: no such file to load — tk

拈花ヽ惹草 提交于 2019-12-06 01:39:24
问题 I'm not able to get ruby to require 'tk' successfully. I'm using rvm, ruby 2.0.0, ActiveTcl-8.6, and Ubuntu 12.04 LTS. I have run wish provided with ActiveTcl and it seems to be working. I've looked on the RVM site http://rvm.io/integration/tk and several StackOverflow questions like this one RVM Ruby with TK installation (OSX). I have tried rvm reinstall 2.0.0 --enable-shared --enable-pthread --with-tk --with-tcl several times on different versions of ruby with no success. Any thoughts? When

How to replace the Python logo in a Tkinter-based Python GUI app?

心不动则不痛 提交于 2019-12-05 22:09:11
Is there a way to change the default logo, which is the Python logo , that appears in the Window's task bar? Notice that I have already successfully replaced the default Tk logo that used to appear in my application window. I am using Windows 7 and Python 2.6 and developing the GUI with the help of Tkinter. You can do this using the winico Tk extension package. The winico package can also be used to add system tray icons to Tk programs. The following sample shows one way to do change the runtime application icon. Note that you need to provide a .ico file with suitable sizes of icons in it on

Separating Tkinter UI concerns from Logic in Python app

末鹿安然 提交于 2019-12-05 19:20:13
This is my first app ever. It is working well but I would like to separate the UI concerns like getting input and creating labels, from the translation logic. I would then like to remove the output from the previous translation, i.e., only showing one translation on the screen at a time. How can I separate the translation logic from my Tkinter GUI? from Tkinter import * import tkMessageBox def start(): inputg = input.get() if len(inputg) >= 2 and inputg.isalpha(): new_word_out = Label(text=(inputg[1:] + (inputg[0] + "ay")).lower().title()).pack() out_message = Label(text="Cool! Try another!")

Is there a limit for the width of a canvas

最后都变了- 提交于 2019-12-05 18:21:20
Is there a limit for the value of the attribute "width" of a canvas ? In the following example, I create a Canvas in a ScrolledWindow. # Packages package require BWidget # Mainframe set mfr [MainFrame .mfr -textvariable "Test"] pack $mfr -fill both -expand yes # Create a Paned Window with two panes set pw1 [PanedWindow [$mfr getframe].pw1 -side left] set pat [$pw1 add -minsize 200] set pai [$pw1 add -minsize 200] pack $pw1 -fill both -expand yes -anchor nw # Create a frame for each pane set tft [TitleFrame $pat.tft -text "Scrollable Canvas"] set tfi [TitleFrame $pai.tfi -text "Informations"]

How can I match background colors for a Frame in a Notebook for ttk/Tkinter on a Mac?

↘锁芯ラ 提交于 2019-12-05 17:37:38
While working on a Tkinter + ttk based GUI on my Mac, I noticed a problem with background colors and the Notebook widget. When adding a ttk.Frame as a ttk.Notebook tab, the displayed background of the frame does not match the 'inset' background for the notebook tab. How can I make the ttk.Frame match the surrounding background color, without hard-coding a value that will look weird for non-Mac users? I read a few SO answers suggesting custom styles, but it's unclear how to query for the parent widget's background color in this situation. As far as I can tell, they're all the same! >>> ttk

Padding specified in style ignored by Ttk Frame

核能气质少年 提交于 2019-12-05 16:13:05
The following code works as expected, presenting a red background button (with lots of padding) in a green background frame (also with lots of padding). Note that Frame padding is specified both in the Style statement and the ttk.Frame initialization. import ttk import Tkinter root = Tkinter.Tk() ttk.Style().configure("TFrame", background="#0c0", padding=60) ttk.Style().configure("TButton", background="#c00", padding=20) frame = ttk.Frame(root, padding=60) frame.pack() btn = ttk.Button(frame, text="Button") btn.pack() root.mainloop() Now, however, remove the 'padding=60' line from the Frame

How to change font and size of buttons and frame in tkinter using python?

时光怂恿深爱的人放手 提交于 2019-12-05 12:28:20
问题 This is the code that i used to generate a simple text box and a button in tkinter. What should be the parameters to have a better look of the frame and buttons? root = Tk.Tk() def submit(): query = entry.get() retrieve(query) entry = Tk.Entry(root) entry.pack() button = Tk.Button(root, text='submit', command=submit) button.pack() root.mainloop() 回答1: UPDATE : The New Mexico Tech tkinter website has been archived on GitHub. First the best reference for Tkinter is this New Mexico Tech website.

tcl/tk学习笔记:数学表达式与 expr 命令

隐身守侯 提交于 2019-12-05 12:06:33
教材:陈涛 Tcl 编程初步 tcl/tk入门经典(2) 1.除了自加自减,tcl的数学和逻辑运算符,运算符优先级,数学函数与相似。 2.自加自减速运算用incr命令完成 incr varName ?step? 没有后一个参数表示加1,incr a -n表示减n。 3.expr命令将它的参数做表达式处理。expr 4+2;expr log10(100); 4.if语句 这个命令会将他的第一个参数当做表达式 if {x<10} {set a=x} 5.在tcl8.5中,当表达式解析器遇到像sin($x),log10($y)等数学函数时,它会将函数替换为对tcl::mathfunc命名空间中一个普通命令的调用。 例 expr {sin($x+$y)}和expr {[tcl::mathfunc::sin [expr {$x+$y}]]}一样。 如果数学函数有多个参数 例 expr pow($x+2,$y/2)和expr {[tcl::mathfunc::pow [expr {$x+2}] [expr {$y/2}]} 6.tcl允许定义自己的数学函数,只在tcl::mathfunc命名空间中创建新的命令就可 例 proc tcl::mathfunc::avg {args} { if {[llength $args] == 0} { return -code error "too few

Should I use Perl/Tk, Tcl::Tk or Tkx for a Perl GUI?

拈花ヽ惹草 提交于 2019-12-05 11:27:36
问题 I really like Perl/Tk , but have come to the opinion that it's DOA. I think Tcl::Tk and Tkx are better solutions. Assume I drop Perl/Tk . Is the "most supported" route to go with Tcl::Tk (which hasn't been updated since 2007, and whose author seemingly cannot be reached), or Tkx ? Are either of these actively used/supported? 回答1: Under the hood both Tcl::Tk and Tkx use the Tcl module as a bridge to Tcl/Tk. The difference is in the API they present to Perl. Tkx was developed by ActiveState,

Python Tkinter Autocomplete combobox with LIKE search?

☆樱花仙子☆ 提交于 2019-12-04 20:46:10
I am trying to populate a Tkinter combobox with pre-defined values to select from. It is populating and I am able to type in and get suggestions. However, in order to do this I have to definitely know the first few characters. If I know some text in the middle or end of the string, its of no use because the combobox does only a 'LIKE%' search and not a '%LIKE%' search . Expected Output (Typing the word "Ceramic" fetches all names containing the string. Note: This is not a Tkinter screenshot ): This is my adaptation of the code till now, if anyone can suggest how to modify the