tkinter

How to lock tkinter button after pressing on it

徘徊边缘 提交于 2021-01-29 04:29:23
问题 how to lock the button after pressing on it, until the other button is pressed or until I closed the program interface? 回答1: I'm not sure what you mean by locking the button, I think you mean disabling. Disabling is just you not being able to click the button until you define the state back to 'normal' Here is some sample code: from Tkinter import * def doDisable(): b2.configure(state=DISABLED) root = Tk() b2 = Button(root, text="Disable button", command=doDisable) b2.pack() root.mainloop()

TypeError: must be str or None, not Frame

泄露秘密 提交于 2021-01-29 04:09:33
问题 Using an OOP approach to developing a tkinter program for the first time based on the sentdex tkinter series. I honestly have no idea what the error here means. The error directs me to: File "C:\Users\Ash\Dropbox\Programming\Python\WorldManager PY\WorldManager.py", line 59, in __init__ tk.Tk.__init__(self, *args, **kwargs) File "C:\Python34\lib\tkinter\__init__.py", line 1867, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)

python tkinter packing

大憨熊 提交于 2021-01-29 03:50:20
问题 Could someone please explain why when you have an plain widget as one line Code A works Entry(root, width=10).pack(side=LEFT,anchor=W) but when you name it or attach a command to it, Code A no longer works and gives you Error Message B self.my_entry = Entry(root, width=10).pack(side=LEFT,anchor=W) and you must pack using a seperate line? self.my_entry = Entry(root, width=10) self.my_entry.pack(side=LEFT,anchor=W) Code A self.my_entry.get() Error Message B AttributeError: 'NoneType' object has

Python 3 & Tkinter buggy and slow

时光怂恿深爱的人放手 提交于 2021-01-29 02:27:58
问题 So, a few months back I made a small GUI for handling NPCs in a roleplaying campaign I was running. I haven't touched in since then, except that now I need it! Tomorrow, in fact... I have a few odd error... Loading the GUI seems to work fine, but when I start to press buttons the troubles start. It seemed, at first, that it the script was very slow, which it shouldn't be, calling a two line dice function on a button press. I accidentally figured out that when I hover the mouse over the "close

Python 3 & Tkinter buggy and slow

浪子不回头ぞ 提交于 2021-01-29 02:22:30
问题 So, a few months back I made a small GUI for handling NPCs in a roleplaying campaign I was running. I haven't touched in since then, except that now I need it! Tomorrow, in fact... I have a few odd error... Loading the GUI seems to work fine, but when I start to press buttons the troubles start. It seemed, at first, that it the script was very slow, which it shouldn't be, calling a two line dice function on a button press. I accidentally figured out that when I hover the mouse over the "close

Get list of Toplevels on Tkinter

╄→尐↘猪︶ㄣ 提交于 2021-01-29 02:12:50
问题 I wanted to know if there is a simple way to get all the toplevels from a specific window, including toplevels within toplevels. In the following code I leave an example of what I want to do: from tkinter import Tk, Toplevel v = Tk() v2 = Toplevel(v) v3 = Toplevel(v2) v4 = Toplevel(v2) def toplevels(ventana): print("Here I return the list of all toplevels, in case of choosing the main window, it should return:") print() print(".") print(".toplevel") print(".toplevel.toplevel") print("

Get list of Toplevels on Tkinter

淺唱寂寞╮ 提交于 2021-01-29 02:11:00
问题 I wanted to know if there is a simple way to get all the toplevels from a specific window, including toplevels within toplevels. In the following code I leave an example of what I want to do: from tkinter import Tk, Toplevel v = Tk() v2 = Toplevel(v) v3 = Toplevel(v2) v4 = Toplevel(v2) def toplevels(ventana): print("Here I return the list of all toplevels, in case of choosing the main window, it should return:") print() print(".") print(".toplevel") print(".toplevel.toplevel") print("

Get list of Toplevels on Tkinter

半城伤御伤魂 提交于 2021-01-29 02:07:24
问题 I wanted to know if there is a simple way to get all the toplevels from a specific window, including toplevels within toplevels. In the following code I leave an example of what I want to do: from tkinter import Tk, Toplevel v = Tk() v2 = Toplevel(v) v3 = Toplevel(v2) v4 = Toplevel(v2) def toplevels(ventana): print("Here I return the list of all toplevels, in case of choosing the main window, it should return:") print() print(".") print(".toplevel") print(".toplevel.toplevel") print("

How to get a Treeview columns to fit the Frame it is within

北城余情 提交于 2021-01-29 02:03:52
问题 When dynamically changing a treeviews data, I want the rows to expand to the size of the treeview's frame. Currently if I make the GUI fullscreen and re-fill the data it only uses a small portion of the available screen-size, i.e. the columns don't resize or stretch to fill the width of the screen (i'm not too concerned with the rows filling). I have produced a minimal working example below: import tkinter as tk from tkinter import ttk import random class App(): def __init__(self): self.root

Python - Tkinter Label Output?

时光怂恿深爱的人放手 提交于 2021-01-29 02:00:36
问题 How would I take my entries from Tkinter, concatenate them, and display them in the Label below (next to 'Input Excepted: ')? I have only been able to display them input in the python console running behind the GUI. Is there a way my InputExcept variable can be shown in the Label widget? from Tkinter import * master = Tk() master.geometry('200x90') master.title('Input Test') def UserName(): usrE1 = usrE.get() usrN2 = usrN.get() InputExcept = usrE1 + " " + usrN2 print InputExcept usrE = Entry