tk

disable tkinter keyboard shortcut (2)

蓝咒 提交于 2019-12-20 04:30:45
问题 I'm proposing a continuation of the discussion in disable tkinter keyboard shortcut: I have an event handler for an event that Tkinter also uses, so that my prog & Tkinter interact badly. Since it is a problem that I've been unable to solve I'm re-proposing here, where I tried to boil it down to the simplest form in the following code: #!/usr/bin/env python from Tkinter import * import tkFont def init(): global root,text root = Tk() root.geometry("500x500+0+0") dFont=tkFont.Font(family="Arial

Tk : how to pass variable values with -command?

一世执手 提交于 2019-12-20 03:56:15
问题 button .mltext.button -text "Apply" -command {set top_tlbl [update_text $top_tlbl $spc ] } I get an error : can't read "spc": no such variable while executing "update_text $top_tlbl $spc " invoked from within ".mltext.button invoke" How can I pass the values of the variables to the update_text function? Maybe I can start by understanding this : (System32) 3 % expr 2 + 2 4 (System32) 4 % list expr 2 + 2 expr 2 + 2 (System32) 5 % [list expr 2 + 2] invalid command name "expr 2 + 2" (System32) 6

How to change the tk version of your Python installation?

喜夏-厌秋 提交于 2019-12-20 02:10:54
问题 I have just removed my old Python framework using this procedure, and I have installed Python 3.4.3 for my architecture, which appears to be i386 according to the following command uname -p , so I have downloaded and installed the following version Mac OS X 32-bit i386/PPC installer. Now, I want to use tkinter , but it seems that it is using the Tcl/Tk version 8.4 instead of the lastest one 8.6 : >>> tkinter.TclVersion 8.4 >>> tkinter.TkVersion 8.4 >>> Now, I have cheked under the directory

tkinter window get x, y, geometry/coordinates without top of window

血红的双手。 提交于 2019-12-19 18:29:32
问题 I am using tk in python (3), though I'd assume that this applies to any language. I am looking to get the current x, y coordinates of a tk window outside of the title bar: import tkinter root = tkinter.Tk() however, using root.winfo_y() gives me the coordinates including the depth of the titlebar. For a window that is in the upper left corner of my screen: root.winfo_x(), root.winfo_y() # returns (0, 22) In other words, running: root.geometry('+{}+{}'.format(root.winfo_x(), root.winfo_y()))

Python/Tkinter: expanding fontsize dynamically to fill frame

耗尽温柔 提交于 2019-12-19 11:29:09
问题 I know you can get frame widgets to expand and fill all of the area available to them in their container via these commands: frameName.pack(fill = 'both', expand = True) What would do the same for a text's font size? Currently my text is an attribute of a label widget. The label widget's parent is frameName . I guess I could define my own function to call labelName.config(fontsize = N) to update the font size as the frame get's bigger, but I'm not sure how to correlate them. This is what my

Quantity limitation for dialog window selecting files?

时光怂恿深爱的人放手 提交于 2019-12-19 04:40:44
问题 Python version: 2.7 Tk version: 8.5 Refer to my previous question how to add the selected files from dialog window to a dictionary? I am trying to select 500 files from dialog window and extract their name as keys for a dictionary. Total files size is around 200M. I have no idea why I got an empty dictionary. However, if I choose less files like 100 each time, it works very well at each time. So my question is that is there any quantity limitation for dialog window selecting files or for keys

Hide console for Tkinter app on OSX

我的梦境 提交于 2019-12-18 17:36:56
问题 I'm trying to hide the Terminal when I launch a GUI Tkinter based app, but when I double click the app.py file on OSX, the Terminal window appears. I've tried changing the extension to .pyw and tried launching it with /usr/bin/pythonw, but no matter what, the Terminal window still appears. I've even tried adding the try/except below, but when I run it I get the error: 'invalid command name "console"' in the Terminal window that appears. from Tkinter import * class MainWindow(Tk): def __init__

unremovable text in tkinter

怎甘沉沦 提交于 2019-12-18 17:26:51
问题 here is some code: from Tkinter import * class Main(object): def __init__(self): self.console = Text(root, relief='groove', cursor='arrow', spacing1=3) self.console.insert(INSERT, '>>> ') self.console.focus_set() self.scroll = Scrollbar(root, cursor='arrow', command=self.console.yview) self.console.configure(yscrollcommand=self.scroll.set) self.scroll.pack(fill='y', side='right') self.console.pack(expand=True, fill='both') root = Tk() root.geometry('%sx%s+%s+%s' %(660, 400, 40, 40)) root

how to use Tcl/Tk bind function on Tkinter's widgets in Python?

天大地大妈咪最大 提交于 2019-12-18 09:15:03
问题 Although Tkinter's derived from Tcl/Tk but it's not as complete as Tcl/Tk. Tcl/Tk bind function has some attributes which tkinter doesn't (e.g. %d that returns The detail field from the event https://www.tcl.tk/man/tcl8.4/TkCmd/bind.htm#M24). Tcl/Tk scripts can be used by "eval" function in python but i don't know how to declare a tkinter widget in Tcl/Tk script. so how can i use this function and its attributes on Tkinter widget? 回答1: If you are asking how to create a binding that makes use

RVM Ruby with TK installation (OSX)

人盡茶涼 提交于 2019-12-18 07:09:08
问题 I'm trying to install Ruby with TK support. Using RVM, I did this: rvm install 1.9.2 -C --enable-shared --enable-pthread The installation appears to work fine, and I can see something called .rvm/src/ruby-1.9.2-p320/ext/tk/tcltklib.c which I assume is the library I need? I then try to run require 'tk' in irb, but get the error message LoadError: no such file to load -- tk Any ideas? Update: Fixed! If anyone is interested in the complete list of steps for a Ruby upgrade to 2.0.0 with TK