tkinter

tkinter.TclError: couldn't recognize data in image file

余生长醉 提交于 2020-12-29 08:35:40
问题 I'm currently in the middle of a recorded Python lecture and I think the version of python the teacher is using is outdated and he is writing a tkinter program but after copying it I keep getting this error: Traceback (most recent call last): File "C:\Users\1234\AppData\Local\Programs\Python\Python36-32\Lecture Class 11.py", line 35, in <module> photo = PhotoImage(file="Me With My 5th Place.jpg") File "C:\Users\1234\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 3539

tkinter.TclError: couldn't recognize data in image file

混江龙づ霸主 提交于 2020-12-29 08:33:55
问题 I'm currently in the middle of a recorded Python lecture and I think the version of python the teacher is using is outdated and he is writing a tkinter program but after copying it I keep getting this error: Traceback (most recent call last): File "C:\Users\1234\AppData\Local\Programs\Python\Python36-32\Lecture Class 11.py", line 35, in <module> photo = PhotoImage(file="Me With My 5th Place.jpg") File "C:\Users\1234\AppData\Local\Programs\Python\Python36-32\lib\tkinter\__init__.py", line 3539

Copying formatted text from Text widget in tkinter

流过昼夜 提交于 2020-12-29 07:44:00
问题 I'm working on an APA citation maker in Python using tkinter. I use the Text widget to display the citation once it's generated, but whenever I copy the text (using the ctrl+c shortcut, at the moment) it loses its formatting. Is there some way to copy formatted text (italicized, for instance) from the Text widget rather than unformatted text? 回答1: To copy formatted text to the clipboard, you need an interface between python and the system's clipboard which supports text formatting. I have

Copying formatted text from Text widget in tkinter

泄露秘密 提交于 2020-12-29 07:41:07
问题 I'm working on an APA citation maker in Python using tkinter. I use the Text widget to display the citation once it's generated, but whenever I copy the text (using the ctrl+c shortcut, at the moment) it loses its formatting. Is there some way to copy formatted text (italicized, for instance) from the Text widget rather than unformatted text? 回答1: To copy formatted text to the clipboard, you need an interface between python and the system's clipboard which supports text formatting. I have

Disabling buttons after click in Tkinter

笑着哭i 提交于 2020-12-29 07:17:04
问题 I'm new to Python and I'm trying to make a simple application using Tkinter. def appear(x): return lambda: results.insert(END, x) letters=["A", "T", "D", "M", "E", "A", "S", "R", "M"] for index in range(9): n=letters[index] nButton = Button(buttons, bg="White", text=n, width=5, height=1, command =appear(n), relief=GROOVE).grid(padx=2, pady=2, row=index%3, column=index/3) What I'm trying to do is disable the buttons once I click them. I tried def appear(x): nButton.config(state="disabled")

How can I put 2 buttons next to each other?

拈花ヽ惹草 提交于 2020-12-29 06:20:10
问题 b = Button(root, text="Enter", width=10, height=2, command=button1) b.config() b.pack(side=LEFT) c = Button(root, text="Clear", width=10, height=2, command=clear) c.pack(side=LEFT) scrollbar = Scrollbar(root) scrollbar.pack(side=RIGHT, fill=Y) text.config(width=35, height=15) text.pack(side=RIGHT, fill=Y) scrollbar.config(command=text.yview) text.config(yscrollcommand=scrollbar.set) How can I put these 2 buttons next to each other ontop of the text widget? when I set "side=LEFT" it just puts

How can I put 2 buttons next to each other?

喜夏-厌秋 提交于 2020-12-29 06:17:09
问题 b = Button(root, text="Enter", width=10, height=2, command=button1) b.config() b.pack(side=LEFT) c = Button(root, text="Clear", width=10, height=2, command=clear) c.pack(side=LEFT) scrollbar = Scrollbar(root) scrollbar.pack(side=RIGHT, fill=Y) text.config(width=35, height=15) text.pack(side=RIGHT, fill=Y) scrollbar.config(command=text.yview) text.config(yscrollcommand=scrollbar.set) How can I put these 2 buttons next to each other ontop of the text widget? when I set "side=LEFT" it just puts

How can I put 2 buttons next to each other?

穿精又带淫゛_ 提交于 2020-12-29 06:16:45
问题 b = Button(root, text="Enter", width=10, height=2, command=button1) b.config() b.pack(side=LEFT) c = Button(root, text="Clear", width=10, height=2, command=clear) c.pack(side=LEFT) scrollbar = Scrollbar(root) scrollbar.pack(side=RIGHT, fill=Y) text.config(width=35, height=15) text.pack(side=RIGHT, fill=Y) scrollbar.config(command=text.yview) text.config(yscrollcommand=scrollbar.set) How can I put these 2 buttons next to each other ontop of the text widget? when I set "side=LEFT" it just puts

How I can solved this name is not defined

北城余情 提交于 2020-12-27 07:23:13
问题 I want to make the program that I made can run i make code like this def cafe_food(self): friedrice_items = tk.Entry(F_FItems) friedrice_items.config(width=7, borderwidth=4, relief="sunken", font=("calibri", 10,"bold"),foreground="white", background="#248aa2") friedrice_items.place(x=81, y=1) def Total_Biil(self): friedrice_price = 10 pizza_price = 20 if friedrice_items.get() != "": friedrice_cost = friedrice_price * int(friedrice_items.get()) else: friedrice_cost = 0 if pizza_items.get() !=

'NoneType' object has no attribute 'get' error on tkinter [duplicate]

﹥>﹥吖頭↗ 提交于 2020-12-27 07:20:47
问题 This question already has answers here : Tkinter: AttributeError: NoneType object has no attribute <attribute name> (3 answers) Closed 11 months ago . I recently started coding in python 3.6 with tkinter and tried creating my own project on repl.it . The project is a simple interactive to-do list, however I am stuck and cant get the function to work. The function is just simply getting the entry and adding it to a list box, but when I try adding the function it returns 'NoneType' object has