tkinter

Tkinter Label not showing Int variable

守給你的承諾、 提交于 2021-02-08 12:02:36
问题 I'm trying to make a simple RPG where as you collect gold it will be showed in a label, but it doesn't!! Here is the code: def start(): Inv=Tk() gold = IntVar(value=78) EtkI2=Label(Inv, textvariable=gold).pack() I'm new to python and especially tkinter so I need help!!! 回答1: The only thing wrong with your code is that you aren't calling the mainloop method of the root window. Once you do that, your code works fine. Here's a slightly modified version that updates the value after 5 seconds:

How to get rid of a label once its text has been renamed?

谁说我不能喝 提交于 2021-02-08 11:48:20
问题 So I have a Label where when a button is pressed, it changes the name of the text to display another label below the existing label. It pretty much just prints the same label with a different text on the row below. When the Delete Text button is pressed, it will delete the new label that has been created but how do I delete the label before the new label? I can also only remove the label via destroy and not forget. I tried changing the text of the variable back to what it says on the window

Py2app app not launching just asks if I want to terminate the app or open console

…衆ロ難τιáo~ 提交于 2021-02-08 11:38:41
问题 So I am working on a little project of mine that I want to distribute easily so naturally, I use py2app to make a single .app file that will execute on any Mac computer. I tried this tutorial: https://www.metachris.com/2015/11/create-standalone-mac-os-x-applications-with-python-and-py2app/. The problem is that even if I try the example that he gives in the tutorial it crashes and shows this window: Crash image if I look in the console log of the event I see these tow errors. error 17:12:44

How Can I add checkbox in ttk Treeview

我是研究僧i 提交于 2021-02-08 11:13:09
问题 I searched very much for this answer,Then I came to know that we can't embedded widgets into Treeview But I found the Features of Treeview. In this below Features It is telling that Treeview will support of including checkbox also. Here is a list of TreeView features: Auto-sizing column widths and row heights. Hide/move columns or nodes. Sortable by columns or sub-trees. External data storage (in a blt::tree). Multiple TreeViews can share all a tree. Easy to use dynamic loading (for sub-trees

How Can I add checkbox in ttk Treeview

给你一囗甜甜゛ 提交于 2021-02-08 11:10:17
问题 I searched very much for this answer,Then I came to know that we can't embedded widgets into Treeview But I found the Features of Treeview. In this below Features It is telling that Treeview will support of including checkbox also. Here is a list of TreeView features: Auto-sizing column widths and row heights. Hide/move columns or nodes. Sortable by columns or sub-trees. External data storage (in a blt::tree). Multiple TreeViews can share all a tree. Easy to use dynamic loading (for sub-trees

Python: Embed a matplotlib plot with slider in tkinter properly

佐手、 提交于 2021-02-08 10:55:34
问题 I have created this plot in pyplot which has a slider to view a certain range of the data. import random import matplotlib import tkinter as Tk import matplotlib.pyplot as plt from matplotlib.widgets import Slider from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg fig, ax = plt.subplots() plt.subplots_adjust(bottom=0.25) y_values = [random.randrange(20, 40, 1) for _ in range(40)] x_values = [i for i in range(40)] l, = plt.plot(x_values, y_values) plt.axis([0, 9, 20, 40]) ax_time

Python: Embed a matplotlib plot with slider in tkinter properly

…衆ロ難τιáo~ 提交于 2021-02-08 10:54:27
问题 I have created this plot in pyplot which has a slider to view a certain range of the data. import random import matplotlib import tkinter as Tk import matplotlib.pyplot as plt from matplotlib.widgets import Slider from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg fig, ax = plt.subplots() plt.subplots_adjust(bottom=0.25) y_values = [random.randrange(20, 40, 1) for _ in range(40)] x_values = [i for i in range(40)] l, = plt.plot(x_values, y_values) plt.axis([0, 9, 20, 40]) ax_time

Python: Embed a matplotlib plot with slider in tkinter properly

旧巷老猫 提交于 2021-02-08 10:54:21
问题 I have created this plot in pyplot which has a slider to view a certain range of the data. import random import matplotlib import tkinter as Tk import matplotlib.pyplot as plt from matplotlib.widgets import Slider from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg fig, ax = plt.subplots() plt.subplots_adjust(bottom=0.25) y_values = [random.randrange(20, 40, 1) for _ in range(40)] x_values = [i for i in range(40)] l, = plt.plot(x_values, y_values) plt.axis([0, 9, 20, 40]) ax_time

Python: Tkinter pausing a while loop

给你一囗甜甜゛ 提交于 2021-02-08 10:53:21
问题 So i'm trying to create a program that displays the cpu usage of your computer in real time. I wanted to use tkinter to add some buttons to the program. I decided to add a stop button that closes the program and a pause button that stops the cpu usage from updating. I was able to create the stop button but when I started the pause button I realized that I was unable to pause the while loop I using. Does anyone know what i'm doing wrong? from tkinter import * import psutil from time import

Use Tkinter to Open file, run script and export file

怎甘沉沦 提交于 2021-02-08 10:52:31
问题 I would like to create a pyton script that takes an excel file (provided by the user), run a script, and save this excel file (with a file name provided by the user). I would like to implement some buttons using Tkinter to enable non-programmers to easily use my algorithm. I tried to create a ''load data'' and ''display data'' button (I took a code online) that both work. However I didn't manage to run the script on the database imported (as I don't know how to access it) I didnt manage to