Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Newbie have thoughts about logic
Post: RE: Newbie have thoughts about logic

https://docs.python.org/3/library/functions.html#print Wrote:print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False) Print objects to the text stream file ...Just because you are using print ...
Yoriz General Coding Help 32 1,057 Sep-12-2021, 06:14 PM
    Thread: exception handling by default
Post: RE: exception handling by default

Use a try/except BrokenPipeError in your function and handle it.
Yoriz News and Discussions 4 216 Sep-11-2021, 10:38 PM
    Thread: New to python and need help with spacing
Post: RE: New to python and need help with spacing

Using python 3 user_input = input("What are your initials? ") print(" ".join(user_input for _ in range(7)))Output:What are your initials? GIS GIS GIS GIS GIS GIS GIS GIS
Yoriz General Coding Help 12 441 Sep-11-2021, 08:27 PM
    Thread: sorting a list of lists by an element
Post: RE: sorting a list of lists by an element

Use sorted with a custom key function data = [[0, False, "c"], [0, True, "z"], [1, False, "P"], [0, True, "A"]] sorted_data = sorted(data, key=lambda x: x[1], reverse=True) print(sorted_data)Output:[[...
Yoriz General Coding Help 3 188 Sep-10-2021, 03:20 PM
    Thread: unpacking list
Post: RE: unpacking list

There is a lists inside of two lists, so iterate over the list of lists by doing for list_value in value[0]: # test_lst = [('IP', '172.17.10.147'), ('IP', '172.16.88.57'), ('IP', '172.16.12.147')] tes...
Yoriz General Coding Help 2 264 Sep-10-2021, 02:55 PM
    Thread: Dictionnary indexing error
Post: RE: Dictionnary indexing error

When it gets to the line that you have the error it is not a dictionary it is a list, it is getting an item by index, not key. self.image2 = self.images[self.current_image]self.images = animations.get...
Yoriz General Coding Help 6 212 Sep-10-2021, 12:11 PM
    Thread: Dictionnary indexing error
Post: RE: Dictionnary indexing error

If I strip out the pygame code I get the following class AnimateSprite: def __init__(self, sprite_name): super().__init__() # load the player self.image2 = f"{sprite_name}....
Yoriz General Coding Help 6 212 Sep-10-2021, 11:49 AM
    Thread: Dictionnary indexing error
Post: RE: Dictionnary indexing error

The code shown doesn't give enough away to help solve the issue. The thread title Dictionnary indexing error but I don't see any sign of a dictionary. The function load_animation_images return a list ...
Yoriz General Coding Help 6 212 Sep-10-2021, 11:15 AM
    Thread: WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH
Post: RE: Unusual Error

Try whats in this thread https://python-forum.io/thread-25656-pos...#pid109722
Yoriz General Coding Help 1 142 Sep-09-2021, 01:25 PM
    Thread: How to terminate a loop in python with button in GUI
Post: RE: How to terminate a loop in python with button ...

Please see Namespace flooding with * imports Here is an example of what you want to do import threading import time import tkinter as tk from dataclasses import dataclass, field btn_state = {True: "n...
Yoriz GUI 6 256 Sep-09-2021, 01:13 PM
    Thread: How to terminate a loop in python with button in GUI
Post: RE: How to terminate a loop in python with button ...

You don't mention which GUI framework you are using, the following links give an idea of a way to use threads with tkinter and wxpython: [Tkinter] How to deal with code that blocks the mainloop, freez...
Yoriz GUI 6 256 Sep-09-2021, 08:32 AM
    Thread: How to terminate a loop in python with button in GUI
Post: RE: How to terminate a loop in python with button ...

A while loop will block a GUI's mainloop, the while loop won't block if it running in a separate thread. A flag variable that can be set outside of the while loop, can be checked in the while loop to ...
Yoriz GUI 6 256 Sep-09-2021, 08:17 AM
    Thread: Add elements to a Dictionary
Post: RE: Add elements to a Dictionary

(Sep-08-2021, 07:29 PM)muzikman Wrote: Greetings, I am trying to loop through a list of move titles and their corresponding rating. ex. Title = 'Rocky', Rating = 5You mention a list and then there...
Yoriz General Coding Help 12 489 Sep-08-2021, 07:42 PM
    Thread: Problem with my pong code
Post: RE: Problem with my pong code

Line 80 if ball.ycor() > -290:should be if ball.ycor() < -290: Line 88 if ball.xcor() > -390:should be if ball.xcor() < -390:
Yoriz Game Development 2 264 Sep-08-2021, 06:18 AM
    Thread: accessing wxwidgets
Post: RE: accessing wxwidgets

Python’s super() considered super! Raymond Hettinger - Super considered super! - PyCon 2015
Yoriz GUI 5 289 Sep-07-2021, 11:20 AM
    Thread: if __name__=='__main__'
Post: RE: if __name__=='__main__'

https://docs.python.org/3/faq/programmin...odule-name Wrote:How do I find the current module name? A module can find out its own module name by looking at the predefined global variable __name__. If t...
Yoriz General Coding Help 3 218 Sep-07-2021, 09:14 AM
    Thread: accessing wxwidgets
Post: RE: accessing wxwidgets

To enable frame.label_1.Hide() to work, label_1 needs to be an attribute of MyFrame in first.py to do this change label_1 to self.label_1 The code you posted did not run, I tided it up and made it ru...
Yoriz GUI 5 289 Sep-06-2021, 09:14 PM
    Thread: Newbie have thoughts about logic
Post: RE: Newbie have thoughts about logic

The for loop has been around for a long time. For loop if you use more descriptive variable names it reads a bit more like English for letter in "banana": print(letter)
Yoriz General Coding Help 32 1,057 Sep-01-2021, 10:33 PM
    Thread: progressbar
Post: RE: progressbar

Not sure what you mean, you can set the maximum value to anything you would like, it defaults to 100.
Yoriz GUI 9 275 Aug-30-2021, 08:50 AM
    Thread: progressbar
Post: RE: progressbar

The ttk.Progressbar can be manually controlled, see the following example: import tkinter as tk from tkinter import ttk class MainFrame(tk.Frame): def __init__(self, *args, **kwargs): su...
Yoriz GUI 9 275 Aug-30-2021, 08:20 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020