FAQ Database Discussion Community


How to get text from Entry widget

python-3.x,tkinter,tk
I've looked at several posts on stackOverflow that explain the answer but no matter which I use, I never can get the string from my entry widget; it just detects a string of "" here's my code: def buttonTest(): global score gui.title("Test") for child in gui.winfo_children(): child.destroy() global questionText global...

Get visible rows in a TCL/ Tk tablelist

tcl,tk
I have a tcl/tk tablelist in my application where large number of rows can be represent. I have a scrodget associated with the table so a scrollbar appears when the element count is larger than a current tablesize. ttk::labelframe .frm -text "Frametitle" ttk::scrodget .frm.sc -autohide both tablelist::tablelist .frm.lb -selectmode $selectmode...

Google Analytics for TCL-TK

google-analytics,tcl,tk
Is there any code for using Google Analytics on a TCL-Tk program? I've tried to implement it "handmade" using a webserver, and sending messages via TclWs but I'm sure that Google Analytics can be a better (or best) solution for this problem....

TCl-Tk How to catch floating point numbers from a file

file,floating-point,tcl,tk
i'm finding some troubles working on a file containing some floating numbers. These are some rows from my file: 174259 1.264944 -.194235 4.1509e-5 174260 1.264287 -.191802 3.9e-2 174261 1.266468 -.190813 3.9899e-2 174262 1.267116 -.193e-3 4.2452e-2 What i'm trying to do is to find the row where is my desire number...

How to add a time delay before a label appears in tkinter?

python,tkinter,delay,tk,timedelay
I am trying to recreate the Pokemon red fight scene and I need a 5 second delay between the first character appearance (the good guy) and the second (the bad guy). I have tried the time.sleep() method however it just waits 5 seconds (sleep time) before launching the program. #Add...

tkinter TclError: can't find package treectrl

python-3.x,tkinter,tcl,tk,python-module
Just installed tktreectrl as shown in this tutorial: https://www.youtube.com/watch?v=ddpYVA-7wq4 but when i try to run my program i'm getting this error. Traceback (most recent call last): File "E:/Python/Competition/Competition.py", line 36, in <module> listbox = TkTreectrl.MultiListbox(window) File "E:\Programs\Python\lib\site-packages\TkTreectrl\MultiListbox.py",line 50, in __init__ Treectrl.__init__(self, master, showroot=showroot, **kw) File "E:\Programs\Python\lib\site-packages\TkTreectrl\Treectrl.py", line 489, in __init__...

Tcl/Tk: horizontal xscrollbar can not shrink as y scollbar

scrollbar,tcl,tk
In the following example code: proc push_button {} { set name [.ent get] .txt insert end "Hello, $name." } frame .frm -relief groove label .lab -text "Enter name:" entry .ent button .but -text "Push Me" -command "push_button" frame .textarea text .txt -width 20 -height 10 \ -yscrollcommand ".srl_y set" -xscrollcommand...

How can I find out if a Tcl_Obj is a certain kind of ttk:: entity, such as ttk:entry?

c++,tcl,tk
I am working with a legacy (Desktop-style, as they're now known) Windows application built mostly in C and C++. When this application is running on a touchscreen Windows laptop, I need to automatically show the touch keyboard when the user taps inside an entry box on a dialog screen. This...

Duplicate Frames Created When Calling a Function in a Tkinter Application

python,python-3.x,tkinter,tk
So this is my first Python GUI project utilizing tkinter. I come from a background in R. I decided after a review of the documentation to create a class to handle the bulk of the work. The problem appears with my incrementer functions fwd() and bck(). If I do not...

Ttk scrollbar's thumb won't resize

tkinter,scrollbar,tk,ttk
It seems that ttk's scrollbar's thumb automatically fills up the whole trough when elements can fit within the view-able area.. Even after I add more elements such that the treeview extends past the view-able area, the scrollbar's thumb still doesn't resize. I've tried updating tk itself but it doesn't seem...

How to get selective data from a file in TCL?

tcl,tk
I am trying to parse selective data from a file based on certain key words using tcl,for example I have a file like this ... ... .. ... data_start 30 abc1 xyz 90 abc2 xyz 214 abc3 xyz data_end ... ... ... How do I catch only the 30, 90...

Expand Text widget to fill the entire parent Frame in Tkinter

python,tkinter,tk
I'm taking my first steps with Tkinter in Python, and I'm already regretting it. So, I got this Text widget, and I'd like for it to expand and fill its entire parent, using the Grid Geometry Manager. According to the examples I've seen, this sample program should work, alas it...

tcl tk binding virtual events for tabs

tcl,tk
I am trying to bind an event to a tab opening in a tcl tk application. I've gotten the virtual event NotebookTabChanged to bind to anytime a tab is changed, however I do not know how to get the tab that was selected. Below is the idea of what I...

Installing Perl/Tk for texdoctk

perl,tk,texdoctk
I'm trying to install Perl/Tk for texdoctk, and I used cpan -i Tk to see OK sign. cpan -i Tk ... 2level/perllocal.pod SREZIC/Tk-804.033.tar.gz /usr/bin/make install -- OK However, when I execute the texdoctk, I have this error message. texdoctk algorithms Can't locate Tk.pm in @INC (you may need to install...

Tkinter windows popping up and not able to close them

python,user-interface,tkinter,tk
I have a tkinter GUI python code that creates a gui interface to my code, in the code later snack sound toolkit is used (which also uses Tk and creates an instance using root = Tk()). As, mainloop of the previously GUI application is already running to everytime snack function...

How to enable the horizontal scroll bar in git gui commit message edit control

git,user-interface,tk,git-gui
I'm using latest msysgit and I can run the git gui to write the commit message. But I see the the message edit control don't have the horizontal scroll bar. See the image shot below(I just labeled 1). Another issue I see is that how can I extend this window...

tablelist label color while mouse hovers

user-interface,tcl,tk
I've configured the background color of some lables of my tablelist by using the columnconfigure $ColumnIndex -labelbgmethod. However, the background color changes while the mouse hovers over the labels. I couldn't find any -activebackground method and I wish the background color will stay the same even when the mouse hovers...

Tkinter impossible to use place()

python,tkinter,tk,place
I just encounter problem. I can't use the place method in some part of my app. for example : root = Tk() gameFrame = Frame(root) gameFrame.place(x=125, y=75) in the begining of my app, i create a some Frame, then my "gameFrame" is positioned with the method place, and it works...

getting values in R from tkentry() widgets

r,user-controls,widget,tcl,tk
I'm trying to create a small interactive window in which user (for now me) can enter specific information regarding power calculations (test name, number of groups, type of data) in order to perform the correct kind of power calculation. I know how to do this directly in R, but I...

TK/TCL, trouble understanding this tic tac toe code snippet

tcl,tk
Can anyone help explain to me what the snippet below does. This code snippet is taken from http://wiki.tcl.tk/12374. It is meant to create a tic tac toe game. There are not many resources out there for understanding Tk/Tcl so this is giving me significant difficulty. proc DrawBoard {{redraw 0}} {...

Different Windows in TKinter

python,user-interface,python-3.x,tkinter,tk
I am having trouble figuring out how to run more than one application in a Tkinter instance. I am planning to have one main window that will call other applications to run. I also want to have the login button set the username and password strings, and then close its...

How do I prevent Tk from adding space?

python,tkinter,tk
I would like to draw tick marks on the side of a progressbar. example: from tkinter import * from tkinter import ttk root = Tk() mainframe = ttk.Frame(root, padding="3 3 12 12") mainframe.grid(column=0, row=0, sticky=(N, W, E, S)) mainframe.columnconfigure(0, weight=1) mainframe.rowconfigure(0, weight=1) TickValue=15 #TickValue=85 ttk.Label(mainframe, text='%2i-' % TickValue).grid(row=1, column=1, sticky=(N,E),...

tcltk R - how to access value returned by function

r,tk,rgui
I just started with tcltk and R. And I am having troubles accessing a computed value by a function called myFun1 when calling a second function myFun2: Here is a simplified version of my UI: Simple tcltk interface library(tcltk) tt <- tktoplevel() topMenu <- tkmenu(tt) tkconfigure(tt, menu = topMenu) fileMenu...

Can a ttk style option be deleted?

python,tkinter,tk,ttk
How can I delete a ttk style? I am unittesting code which includes ttk styles and each needs to be deleted in the test fixture's tear down method otherwise the style setting made in test 1 affects the results of test 2. In the following simplified example I set a...

How do I return a result from a dialog?

python-3.x,tkinter,call,tk
I have created a dialog, everything is fine, except when I have in some way to return the result. The problem of getting a user's choice from a dialog is that we don't know when he/she will click for example ok or cancel. I have tried to see how standard...

Tkinter background colour issue

python,tkinter,tk,tkinter-canvas
I have a script that has a Tkinter module in it that i would like to change the background color in 3min intervals e.g green for 3mins then orange then red. I have the code to display the green but can't get it to change. When I make a function...

One frame at top of window, one at bottom

python,tkinter,tk
I have two textboxes, I'd like the first one to be at the very top of the window and the other at the very bottom. I'm using python 2.7, this is what I've tried: from Tkinter import * import ttk def main(): root = Tk() root.title("Testing") root_frame = ttk.Frame(root, padding="3...

Cannot get python 2.7 tkinter text editor find function to work

string,python-2.7,tkinter,text-editor,tk
recently I have been working on a GUI python plain text editor. The code calls this function def Find(): win = Toplevel() Label(win, text="Find:").pack() e1 = Entry(win) e1.pack() Button(win, text="Find Me!!!!", command=win.destroy).pack() targetfind = e1.get() print targetfind if targetfind: where = textPad.search(targetfind, INSERT, END) if where: print where pastit =...

Replace several lines of commands with a single variable in tcl

tcl,tk
I know I have been asking a lot of questions but I'm still learning tcl and I haven't found anything that similar to this issue anywhere so far. Is it at all possible to replace a set f commands in tcl with one variable function0 for example? I want to...

tk entry background color change in readonly mode

tcl,tk,entry
Hi I have a requirement where i need to create table and the cells would be readonly. But along with readonly mode, the cells need to have colored background. Now with the given options, i tried doing something like below but with no luck. Since I am learning GUI designing,...

Set Entry widget values dynamically in Tkinter

python,tkinter,tk
I have a window to browse a folder containing necessary files. I am using tkFileDialog for the same. I want to set the value of Entry widget equal to this selected folder. Initially when no folder is selected it will be null. As soon as I select the folder, the...

ImportError: cannot import name 'Tk'

python,ubuntu,python-3.x,tkinter,tk
I am writing a program in python on ubuntu, but since couple of days I am facing this problem which is very irratating, Traceback (most recent call last): File "/home/tansen/Documents/python2/button25_01JanV1.py", line 1, in <module> import Tkinter,ttk File "/home/tansen/Documents/python2/Tkinter.py", line 1, in <module> from Tkinter import Tk, Label, Button ImportError: cannot...

Can i store subroutines with parameters in a hash?

perl,tk
I am building a project in perl/tk that will allow timers to be started to track project work. I have ground to a halt with how to store the command for a button as subroutine but with a parameter. Since the subroutine with parameter is being executed then the result...

Tkinter Frame Doesn't Fill Remaining Space

python,tkinter,tk
This is my first encounter with Tkinter, and I'm beating my head against a wall over this. Ultimately, I am wanting a layout that uses a Frame along the left edge that contains a stack of buttons (navigation). This should be hard-wired to 100 px wide and take up all...

Running multiple exec commands and waiting to finish before continuing

background,tcl,exec,tk
I know I ask a lot of questions and I know there is a lot on here about this exactly what I am trying to do but I have not been able to get it to work in my script nor figure out why it does not let me do...

Tkinter label go at the bottom of the frame

python,tkinter,label,tk,pack
I have kind of a problem with my little Python application using Tkinter and the pack layout management. I don't understand why the labels go at the bottom of the frame. Here is the code: class App: def __init__(self, master): frame = Frame(master) frame.pack() photo = PhotoImage(file="icone.gif") self.label = Label(image=photo)...

Padding specified in style ignored by Ttk Frame

python,tkinter,tk,ttk
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)...