Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Encrypt and decrypt in python using own fixed key
Post: RE: Encrypt and decrypt in python using own fixed ...

It's working perfectly here. Post the complete error.
dboxall123 General Coding Help 3 4,883 Feb-20-2022, 01:18 PM
    Thread: Encrypt and decrypt in python using own fixed key
Post: RE: Encrypt and decrypt in python using own fixed ...

Hi. I can't say that I've ever used the cryptography module, but I got this and modified this from the cryptography website: import base64 import os from cryptography.fernet import Fernet from crypto...
dboxall123 General Coding Help 3 4,883 Feb-19-2022, 01:03 PM
    Thread: Nested conditionals vs conditionals connected by operators
Post: RE: Nested conditionals vs conditionals connected ...

(Feb-18-2022, 07:24 PM)deanhystad Wrote: Worrying about the performance of an if statement inside a function is a bit kooky. If you want speed, you get more efficiency by not calling a function. G...
dboxall123 General Coding Help 8 3,076 Feb-18-2022, 09:34 PM
    Thread: Nested conditionals vs conditionals connected by operators
Post: RE: Nested conditionals vs conditionals connected ...

(Feb-18-2022, 03:49 PM)deanhystad Wrote: Being Truey is not a good test for not None unless the only possible values are None and something that is always Truey. This also doesn't check if c is not...
dboxall123 General Coding Help 8 3,076 Feb-18-2022, 06:40 PM
    Thread: Nested conditionals vs conditionals connected by operators
Post: RE: Nested conditionals vs conditionals connected ...

That's great, thanks. I must admit, I've never actually used yield. I remember trying to learn it a few years ago, when I was new to Python, and programming in general, and it just went over my head, ...
dboxall123 General Coding Help 8 3,076 Feb-18-2022, 06:18 PM
    Thread: Nested conditionals vs conditionals connected by operators
Post: RE: Nested conditionals vs conditionals connected ...

(Feb-18-2022, 02:07 PM)Gribouillis Wrote: I suggest this more readable version def check_for_kill(self, player, row, col) r = self.pieces[row] if col >= 2: c, c1, c2 = r[col], r[c...
dboxall123 General Coding Help 8 3,076 Feb-18-2022, 03:53 PM
    Thread: Init an indefinite number of class
Post: RE: Init an indefinite number of class

(Feb-18-2022, 01:48 PM)ndc85430 Wrote: Really, that's nearer as a list comprehension: players = [Player() for _ in range(1, x + 1)]Wouldn't this be easier players = [Player()] * x
dboxall123 General Coding Help 9 2,323 Feb-18-2022, 01:55 PM
    Thread: Init an indefinite number of class
Post: RE: Init an indefinite number of class

I don't understand what you're doing on that bottom line, couldn't you just do this?: players = [] for i in range(1, x+1): players.append(Player())Or maybe even: players = [Player()] * x
dboxall123 General Coding Help 9 2,323 Feb-18-2022, 01:40 PM
    Thread: Nested conditionals vs conditionals connected by operators
Post: Nested conditionals vs conditionals connected by o...

The following code is a short extract from a game I'm making, called tablut, also known as viking chess. def check_for_kills(self, player, row, col): typ = self.pieces[row][col].type deaths = [] ...
dboxall123 General Coding Help 8 3,076 Feb-18-2022, 01:21 PM
    Thread: Pygame and tkinter
Post: RE: Pygame and tkinter

That's because tk does not have an attribute named Tk. It does have a class named Tk though, so try creating an instance of Tk, like this: root = tk.Tk()
dboxall123 General Coding Help 1 1,506 Feb-14-2022, 12:04 PM
    Thread: Cannot get pygame.JOYBUTTONDOWN to register
Post: RE: Cannot get pygame.JOYBUTTONDOWN to register

That works, thank you! I thought I was doing the same thing as the example in the pygame docs, but upon closer inspection, I found the following lines inside the main loop: # For each joystick: ...
dboxall123 Game Development 4 2,690 Feb-14-2022, 11:57 AM
    Thread: Cannot get pygame.JOYBUTTONDOWN to register
Post: Cannot get pygame.JOYBUTTONDOWN to register

Hello all, I'm messing around with a usb joystick I got online, and I cannot seem to get pygame to register it. I have written the following, simple code: import pygame as pg pg.init() pg.joystick....
dboxall123 Game Development 4 2,690 Feb-13-2022, 07:01 PM

User Panel Messages

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