tkinter

python How to sum all the numbers in a treeview column

天涯浪子 提交于 2021-02-17 04:54:55
问题 I need to sum all the numbers of the "Total Sum" Column of Treeview: The code is: from tkinter import ttk import tkinter as tk from tkinter import* def update(): listBox.insert('','end',value=('APL', t1.get(),t2.get(),t3.get())) root = tk.Tk() root.geometry('1000x600') e8 = tk.Label(root,text="APL").grid(row=1,column=0) t1 = tk.Entry(root) t1.grid(row=1,column=1) t2 = tk.Entry(root) t2.grid(row=1,column=2) t3 = tk.Entry(root) t3.grid(row=1,column=3) cols = ('name', 'No1', 'No2', 'total sum')

Receiving ValueError: invalid recstyle object

。_饼干妹妹 提交于 2021-02-17 02:06:18
问题 I am following the instructions of a pygame project on youtube, this is the video, I am on the project called "Snake", and in the description of the video, you can find what time it starts and the actual code. I am about 10 minutes into the video. I will show you the code that I have written so far: # Snake project on python import math import random import pygame import tkinter as tk from tkinter import messagebox class cube(object): rows = 0 w = 0 def __init__(self, start,dirnx=1, dirny=0,

Receiving ValueError: invalid recstyle object

橙三吉。 提交于 2021-02-17 02:05:44
问题 I am following the instructions of a pygame project on youtube, this is the video, I am on the project called "Snake", and in the description of the video, you can find what time it starts and the actual code. I am about 10 minutes into the video. I will show you the code that I have written so far: # Snake project on python import math import random import pygame import tkinter as tk from tkinter import messagebox class cube(object): rows = 0 w = 0 def __init__(self, start,dirnx=1, dirny=0,

How to add levels in a game built in python onely with TKINTER? [closed]

ぃ、小莉子 提交于 2021-02-16 21:25:58
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed yesterday . Improve this question I'm working on a memory game that you have to find the position of the red ball,once you move your ball, the red one disappeare, so in order to get more points you had to move as fast as you can, my problem is how to add more levels, for example Level 1 : find

How to add levels in a game built in python onely with TKINTER? [closed]

£可爱£侵袭症+ 提交于 2021-02-16 21:24:57
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed yesterday . Improve this question I'm working on a memory game that you have to find the position of the red ball,once you move your ball, the red one disappeare, so in order to get more points you had to move as fast as you can, my problem is how to add more levels, for example Level 1 : find

Getting the fill color or any other property of a item drawn in a canvas in tkinter(Python)

為{幸葍}努か 提交于 2021-02-16 20:52:21
问题 I want to get the fill color or any other property of a item drawn in a canvas in tkinter. def createWidgets(self): self.canvas_1= tk.Canvas(self, bg='#FAFAFA',selectforeground='#BBDEFB'); i=self.canvas_1.create_rectangle((self.canvas_1.winfo_reqwidth()/2)+100, (self.canvas_1.winfo_reqheight()/2)+50, (self.canvas_1.winfo_reqwidth()/2)+150, (self.canvas_1.winfo_reqheight()/2)+100, fill='#FF4081',width=0) self.canvas_1.grid(); color= #want to access the fill color of item i using some getter

Why do I need to explicitly import the font module from the tkinter module even if have imported the full module using “*”?

孤街醉人 提交于 2021-02-16 19:19:54
问题 I have tried to run the give python snippet: from tkinter import * from tkinter import font root = Tk() list_fonts = list(font.families()) for i in list_fonts: print(i) root.mainloop() I get the output as: Sitka Display Sitka Banner Nirmala UI Semilight Leelawadee UI Gadugi Microsoft New Tai Lue DokChampa Segoe UI Calibri Miriam Angsana New Iskoola Pota Kartika Segoe UI Semilight Vijaya Nirmala UI Mongolian Baiti Microsoft YaHei @Microsoft YaHei Microsoft YaHei UI @Microsoft YaHei UI Vani

Embed a .wav file in Python with pyinstaller

那年仲夏 提交于 2021-02-16 14:12:53
问题 This is the code I am running: import tkinter from pygame import mixer root = tkinter.Tk() mixer.init() mixer.music.load(r'C:\Users\George\AppData\Local\Programs\Python\Python36-32\Scripts\Music\Am_lie_-_JY_Suis_Jamais_All_-Yann_Tiersen.wav') mixer.music.play() root.mainloop() I convert this to windows .exe with py2exe giving: pyinstaller -w -F -i "C:\Users\George\AppData\Local\Programs\Python\Python36-32\Scripts\test.ico" sound.py What I want to do is make the wav file embedded in the python

Python tkinter find which button is clicked

落花浮王杯 提交于 2021-02-16 09:01:22
问题 I am trying to implement a game called "Five In a Row". And I create a 15×15 list to put the buttons. (I used range(16) because I also want a row and a column to display the row number and column number) I hope my implementation will be like when a button is clicked, it becomes a label. But I don't know which button the user clicks. How am I able to implement that? Thanks! from tkinter import * root=Tk() root.wm_title("Five In a Row") buttonlst=[ list(range(16)) for i in range(16)] chess

In Tkinter, How I disable Entry?

我的未来我决定 提交于 2021-02-16 06:05:59
问题 How I disable Entry in Tkinter. def com(): .... entryy=Entry() entryy.pack() button=Button(text="Enter!", command=com, font=(24)) button.pack(expand="yes", anchor="center") As I said How I disable Entry in com function? 回答1: Set state to 'disabled' . For example: from tkinter import * root = Tk() entry = Entry(root, state='disabled') entry.pack() root.mainloop() or from tkinter import * root = Tk() entry = Entry(root) entry.config(state='disabled') # OR entry['state'] = 'disabled' entry.pack(