Mr. Jones, I have found your videos to be of the highest level of clarity and utility. Thanks a ton.
@samiadel7043 Жыл бұрын
Great, really I'm shocked sir, you're giving what I was looking for, thank you 💕 God bless you .
@bishtss16 жыл бұрын
Excellent way of teaching, animation makes the concept more clearer and easy to remember.
@bantuthomas4 жыл бұрын
Like Elbichnito has suggested below, could you show if different threads can execute different parts of a tkinter app. Often, a loop with a sleep in one part of the code puts the rest of the code to sleep till that part of the code is competed. An example is given below: from tkinter import * from time import sleep def Timer(): for i in range(5): sleep(1) win = Tk() Timer() btn1 = Button(win, text="Click") btn1.place(x=50, y=50) win.mainloop() Thanks a million for the great work you have done.
@johnphilipjones4 жыл бұрын
I will be developing a series on threads in Python in the coming months. Best wishes Phil
@KOLLECT0R5 жыл бұрын
Would you please make threading, beautiful soup. Sqlite and socket tutorials. The best explanation tutorials ever in youtube. Thank you so much.
@johnphilipjones5 жыл бұрын
Thank you for your positive comments. The topics you have suggested are in the pipeline. Best wishes Phil Jones
@KOLLECT0R5 жыл бұрын
@@johnphilipjones I am a self taught and I did not know what you meant by the pipeline.
@johnphilipjones5 жыл бұрын
"in the pipeline" is an English saying. It means in the process of being planned. In this case I will in the near future be developing videos on the topics you have suggested. Best wishes Phil
@KOLLECT0R5 жыл бұрын
@@johnphilipjones thank you so much for your time and effort.
@oldreddragon15796 жыл бұрын
Hi, just tried the underline with a value of 2 and saw that the letter "l" in "Hello World" was underlined so I was wondering if it has anything to do with hotkeys? BTW This series has been really informative so thanks.
@johnphilipjones6 жыл бұрын
Thank you for the positive comments. The underline is useful when using it with a button as it allows you to invoke the mouse click event of the button with appropriate key-presses. Regards Phil
@dimitriosdesmos46995 жыл бұрын
Hello, how can I access the Label help files in order to read the documentation on each Key/Value combination ? thank u
@johnphilipjones5 жыл бұрын
You may find this link useful: docs.python.org/3.7/library/tkinter.html?highlight=label%20options
@rickybeeSE5 жыл бұрын
I am trying to use this technique to change an image assigned to a label. But I get the error str object does not support item assignment.
@johnphilipjones5 жыл бұрын
Can you paste the code as a reply Thanks Phil
@rickybeeSE5 жыл бұрын
@@johnphilipjones Thanks for the reply. Unfortunately I cannot simply paste the code here as it is about 250 lines currently and contains information on a layout of a secure, private network. The program works but my problem has been that it crashes, out of memory, in a few hours. I have 150 icons that need to change between 3 states periodically. And when you create a new label in tkinter it uses memory, and that memory is not released if a new label is placed on top. So with each change memory is used. With text on a label you can use StringVar(), what's needed is the equivalent ImageVar(). I have done some further tests using the technique in this video and they do work, so I am now thinking that the error I'm getting is being caused by this statement getting bad information. I'll need some more time to figure this out.
@rickybeeSE5 жыл бұрын
@@johnphilipjones I put together a simple program to illustrate the problem with using the key variable for images in labels, which gives the error I mentioned in the original post. If you have time I'd really like your input on this, if it can be made to work, or if there's another way to accomplish the same thing. TIA import tkinter as tk import time window = tk.Tk() window.title("PiStatus") window.geometry("500x500+0+0") ct = 0 pc_on_icon = tk.PhotoImage(file="1.png") pc_active_icon = tk.PhotoImage(file="2.png") pc_off_icon = tk.PhotoImage(file="0.png") # This loop creates the base 15x10 grid of labels, each with a unique name. for ypos in range(10): for xpos in range(15): label_name = "icon" + str(xpos) + "-" + str(ypos) label_name = tk.Label(window, image=pc_on_icon) label_name.grid(row=ypos, column=xpos) while True: # These statements cycle through the 3 images if ct == 0: turn = pc_off_icon elif ct == 1: turn = pc_on_icon else: turn = pc_active_icon # This loop references each label giving it a different image each time around for ypos in range(10): for xpos in range(15): label_name = "icon" + str(xpos) + "-" + str(ypos) label_name['image'] = turn # this is where the error occurs. ct += 1 if ct == 3: ct = 0 window.update() window.mainloop()
@rickybeeSE5 жыл бұрын
This has been solved. It's been a learning experience getting my head around how labels work, that if you set Label_1=...... you can't push an element into Label_1, it is not a variable. You have to create a reference to what comes after Label_1 and keep it in memory. What I did was create a list that contains an ID based on the x/y co-ords of the label position, then the label. Appending these two items to the list for each label. Then later in the program I can reference the ID and the label is the next element.
@johnphilipjones5 жыл бұрын
Hello Richard, Sorry I did not get back to you in time but glad you have now solved it. Best wishes Phil