tkinter

Matplotlib - _tkinter.TclError: bad screen distance “320.0” [closed]

五迷三道 提交于 2021-01-29 07:44:48
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 8 years ago . File "main.py", line 52, in <module> r2n(name) File "C:\Users\Riki\Documents\Universita\Erasmus\Personalization and Metadata modeling 02817\Final Project

Matplotlib - _tkinter.TclError: bad screen distance “320.0” [closed]

好久不见. 提交于 2021-01-29 07:31:18
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 8 years ago . File "main.py", line 52, in <module> r2n(name) File "C:\Users\Riki\Documents\Universita\Erasmus\Personalization and Metadata modeling 02817\Final Project

Update on the fly a ttk.OptionMenu without affecting its previous callback/command

若如初见. 提交于 2021-01-29 07:26:28
问题 I am doing a large GUI with different ttk.OptionMenu widgets that need to be updated often depending on the interaction with the user. Each time the user selects another value from the menu, there is a function callback by the widget via the command input. The command works fine until I need to update the possible values within the OptionMenu widget. After updating using add_command , my previous callback does not work anymore. Is there any way of updating the possible inputs of a ttk

No errors but not getting an expected output [duplicate]

浪尽此生 提交于 2021-01-29 07:15:10
问题 This question already has answers here : How can I get dict from sqlite query? (14 answers) <sqlite3.Row object at 0x1017fe3f0> instead of database contents (1 answer) Python Class SQLite3 request returns object (2 answers) Closed 4 months ago . import sqlite3 class DBConnect(): def __init__(self): self.db=sqlite3.connect("Registrations.db") self.db.row_factory=sqlite3.Row self.db.execute("create table if not exists Ticket(ID integer Primary key autoincrement,name text,gender text,comment

Using .config in tkinter

余生长醉 提交于 2021-01-29 07:11:02
问题 Beginner here Having trouble getting a label to update on a simple countdown app, Can anyone explain why the label does not update in the loop? import time import tkinter as tk root = tk.Tk() root.geometry('150x100') seconds_inp = tk.Entry(root) global time_label time_label = tk.Label(root, text = '00', font = 20) start_button = tk.Button(root, text = 'start', command = lambda: countdown_clock(int(seconds_inp.get()))) def countdown_clock(seconds): while True: seconds = seconds - 1 time.sleep

Hangman cannot update image one by one

主宰稳场 提交于 2021-01-29 07:04:54
问题 from tkinter import * from tkinter import messagebox import random class homewindow(object): def __init__(self,win): self.words = ['rainbow','geography','testimonial','science','effort','amusing'] self.hidden_wd = random.choice(self.words) self.words.remove(self.hidden_wd) self.photo_list = [PhotoImage(file='1.gif'), PhotoImage(file='2.gif'),PhotoImage(file='3.gif'), PhotoImage(file='4.gif'),PhotoImage(file='5.gif'), PhotoImage(file='6.gif'),PhotoImage(file='7.gif'), PhotoImage(file='8.gif')

How to change the button color when the button is press?

蹲街弑〆低调 提交于 2021-01-29 07:03:00
问题 I have a button that has an orange background. But on pressing the button the colour does not remain the same. It changes to its default colour. And on release of button I get back the same colour. Is it possible to change the colour of the button while the button is being pressed? My code is: b = Button(frame1, text='Quit', command=quit_func) b.grid(row=6,column=4,pady=5,padx=10) b.config( background="darkorange1", foreground="white") 回答1: Button widget takes activebackground and

How to call a function with arguments in “Button” function from “tkinter” python package? [duplicate]

北慕城南 提交于 2021-01-29 06:50:38
问题 This question already has answers here : Why is the command bound to a Button or event executed when declared? (5 answers) Closed 2 years ago . What i want to do : 1.To create a File Dialog box with an option to select a file 1.1 First button to select file read its location ->Able to do it with the solution provided from below link filedialog, tkinter and opening files from tkinter import * from tkinter.filedialog import askopenfilename from tkinter.messagebox import showerror class MyFrame

How is Tkinter handling lambda after binding event?

ぐ巨炮叔叔 提交于 2021-01-29 06:46:13
问题 I am trying to write some code that will send the value of an Entry box to a function based on a binding. I can technically get the behavior I want in the code below, but I'm a) not sure why it works and b) am quite sure I am not doing this in the most pythonic way. I'm pretty sure I'm misunderstanding the event or lambda or both. In the code below the Entry box called input_box1 when the binding triggers, the inp_var1.get() code only gets the default value, not anything that has been entered

Get input in Python tkinter Entry when Button pressed

微笑、不失礼 提交于 2021-01-29 06:39:09
问题 I am trying to make a 'guess the number' game with Pyhon tkinter but so far I have not been able to retrieve the input from the user. How can I get the input in entry when b1 is pressed? I also want to display a lower or higher message as a clue to the player but I am not sure if what I have is right: import time import random import decimal import tkinter as tk root = tk.Tk() randomnum = float(decimal.Decimal(random.randrange(100,10000))/100) guess = 0 def get(entry): guess = entry.get()