tk

How to make a scrollable frame with canvas in Ruby TK?

这一生的挚爱 提交于 2021-01-29 07:20:19
问题 I need to scroll a frame that contains multiple labels. Since frames aren't scrollable, so i've choosed to use a canvas that contains a frame with these labels in it. But this would be the first time for me using a canvas, so i really don't know where to start, i ended up with this code: canvas=TkCanvas.new(root) {grid :row =>0, :column =>0} frame=TkLabelframe.new(canvas) {grid :row =>0, :column =>0} scroll=Tk::Tile::Scrollbar.new(root) {orient 'vertical'; grid :row =>0, :column =>1, :sticky

How can I get TK buttons, generated by a for loop, to pass input to their command? (Python)

岁酱吖の 提交于 2021-01-28 05:36:40
问题 I have a program which dynamically generates a GUI. I don't know how many buttons I will have, if any at all. The specific problem is something like this: for varname in self.filetextboxes: if self.varDict[varname]=='': self.varDict[varname] = (StringVar(),) self.varDict[varname][0].set('') fileButton = Button(self, text=" ", command = lambda:self.varDict[varname][0].set(tkFileDialog.askopenfilename()), image=self.filephoto) ftb = Entry(self, textvariable = self.varDict[varname][0],width=40

How to remove icursor from Tkinter canvas text item?

泪湿孤枕 提交于 2021-01-05 09:26:05
问题 I'm following along with Effbot's Tkinter page here: http://effbot.org/zone/editing-canvas-text-items.htm The trouble I'm having is that after inserting the icursor, I can't seem to get it to go away! How do I stop editing altogether? As for examples, the one from the linked page will work: # File: canvas-editing-example-1.py # # editing canvas items # # fredrik lundh, december 1998 # # fredrik@pythonware.com # http://www.pythonware.com # from tkinter import * #Change to Tkinter to use python

Tkinter GUI app runs slower as time goes on

你离开我真会死。 提交于 2021-01-05 04:47:53
问题 I am designing a GUI that shows the number of packets on a node at a given cycle. The program adds one to the counter every loop and updates the GUI with the new info, so that every ~0.1 seconds a different layout is drawn by the GUI. There are 7 different layouts, and when the program gets to layout 7 it goes back to 0, creating an infinite loop of the 7 layouts. This is intended. The problem is the program runs slower as time goes on, i.e. it takes about 0.101 seconds to increment from 0 to

Python Tkinter throwing Tcl error

北城以北 提交于 2020-12-29 09:47:28
问题 I am learning basic GUI in Python, and I came across a sample example to read file name from file explorer on Stack Overflow. from Tkinter import Tk from tkFileDialog import askopenfilename Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing filename = askopenfilename() # show an "Open" dialog box and return the path to the selected file print(filename) This particular script is working fine when I am trying to run it in IDLE, but the same is not running if I am

Tkinter filedialog breaks entry widgets

喜欢而已 提交于 2020-12-27 05:48:54
问题 tl;dr: When the application calls tkinter.filedialog , entry fields do not properly focus. Long explanation: When initializing a tkinter application, the entry fields are enabled by default. Their state is tk.ENABLED , they can be focused on by scrolling through fields with tab , and, most importantly, they can be clicked on to select the field. For some reason, this behavior is broken by calling tkinter.filedialog . If a method of tkinter.filedialog is called, such as askdirectory or

Tkinter filedialog breaks entry widgets

本秂侑毒 提交于 2020-12-27 05:47:22
问题 tl;dr: When the application calls tkinter.filedialog , entry fields do not properly focus. Long explanation: When initializing a tkinter application, the entry fields are enabled by default. Their state is tk.ENABLED , they can be focused on by scrolling through fields with tab , and, most importantly, they can be clicked on to select the field. For some reason, this behavior is broken by calling tkinter.filedialog . If a method of tkinter.filedialog is called, such as askdirectory or

How to make a tkinter Entry field mandatory to enter some text?

爱⌒轻易说出口 提交于 2020-12-13 03:27:45
问题 like in HTML tag attribute required=required I want make an Entry widget mandatory, the user must enter data in it, otherwise don't proceed to next step. How to do it with tkinter? 回答1: There is no attribute "required" in Tkinter, you need to write a function to check whether the user entered data in the entry or not. Then use this function as the command of the "Next" button. import tkinter as tk def next_step(): if mandatory_entry.get(): # the user entered data in the mandatory entry:

How to make a tkinter Entry field mandatory to enter some text?

二次信任 提交于 2020-12-13 03:26:38
问题 like in HTML tag attribute required=required I want make an Entry widget mandatory, the user must enter data in it, otherwise don't proceed to next step. How to do it with tkinter? 回答1: There is no attribute "required" in Tkinter, you need to write a function to check whether the user entered data in the entry or not. Then use this function as the command of the "Next" button. import tkinter as tk def next_step(): if mandatory_entry.get(): # the user entered data in the mandatory entry:

How to make a tkinter Entry field mandatory to enter some text?

核能气质少年 提交于 2020-12-13 03:26:33
问题 like in HTML tag attribute required=required I want make an Entry widget mandatory, the user must enter data in it, otherwise don't proceed to next step. How to do it with tkinter? 回答1: There is no attribute "required" in Tkinter, you need to write a function to check whether the user entered data in the entry or not. Then use this function as the command of the "Next" button. import tkinter as tk def next_step(): if mandatory_entry.get(): # the user entered data in the mandatory entry: