Posts: 4,558
Threads: 1,463
Joined: Sep 2016
what have you learned recently that impacts your programming in Python or anything else you regularly do?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,558
Threads: 1,463
Joined: Sep 2016
so, what you learn (if anything) does not affect what you do, either at work, or at home, or anywhere else?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 26
Threads: 13
Joined: Jul 2019
I just came back into coding from a 4 week hiatus (vacation)
In that regard I just picked up how to make pygame recognize my mouse input, I was also able to find out how to pinpoint where my mouse is at any given time and create outputs based on where I perform certain actions with the mouse.
It's a very minor thing but it helps me move forward, I have a small little project I want to make now and I'm very motivated
Posts: 4,558
Threads: 1,463
Joined: Sep 2016
can your mouse go offscreen? if it can, do you get an offscreen position? is there a way for the code to change the mouse position.
years ago a friend of mine made a program that took over the mouse and window manager so that every time you click on a window it would move them around so that nothing was under the mouse. if he was around today i'd suggest he do it for the mouse hovering over a window, too.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 26
Threads: 13
Joined: Jul 2019
(Jul-19-2022, 12:25 AM)Skaperen Wrote: can your mouse go offscreen? if it can, do you get an offscreen position? is there a way for the code to change the mouse position.
years ago a friend of mine made a program that took over the mouse and window manager so that every time you click on a window it would move them around so that nothing was under the mouse. if he was around today i'd suggest he do it for the mouse hovering over a window, too.
There is probably a way, but I do not know how. I'm only using it to move a crosshair to a target that I want to eliminate (I'm making a minigame)
There is however a suprsingly huge amount of decent examples out and about, so if one wanted to, they could probably make it in no time.
Posts: 4,558
Threads: 1,463
Joined: Sep 2016
(Jul-20-2022, 10:47 PM)Jan_97 Wrote: There is probably a way, but I do not know how. I'm only using it to move a crosshair to a target that I want to eliminate (I'm making a minigame) sounds like something i should put in my text editor for python mode.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,487
Threads: 69
Joined: Jan 2018
Aug-17-2022, 08:23 PM
(This post was last modified: Aug-17-2022, 08:23 PM by Gribouillis.)
Today I learned that Linux has the two commands 'true' and 'false'. They are part of GNU coreutils: /usr/bin/true does nothing, successfully.
/usr/bin/false does nothing, unsuccessfully
One can add ignored command line arguments.
I need it because some file extensions trigger "share with skype" by default and I don't want that and I don't know how to get rid of it, so I updated a configuration file to replace 'skype' by '/usr/bin/true'.
Posts: 721
Threads: 113
Joined: Dec 2017
Sep-01-2022, 06:03 AM
After receiving error messages like "Image has no attribute open",
I could not figure out why a simple img = Image.open(x.jpg), refused to do it's job.
Especially since it worked the previous 1_000 times.
from PIL import Image After a while it was revealed that it was a "circular" problem.
tkinter also has an "Image" keyword and it competes for attention with the Image
from pillow.
The solution is to import it this way:
import PIL.Image Happy.
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Posts: 456
Threads: 16
Joined: Jun 2022
Sep-01-2022, 06:54 AM
(This post was last modified: Sep-01-2022, 06:46 PM by rob101.
Edit Reason: typo
)
A nice way to get the number of days, for any given number of hours, without using any dependences.
This could be extended to weeks for days, months for weeks, and so on.
day = 24 # number of hours in a day
hours = 172 # number of given hours
days, hrs = hours//day, hours%day
print("{} Days, {} hrs".format(days, hrs))
# output = 7 Days, 4 hrs
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Posts: 4,487
Threads: 69
Joined: Jan 2018
Sep-01-2022, 07:47 AM
(This post was last modified: Sep-01-2022, 07:48 AM by Gribouillis.)
(Sep-01-2022, 06:54 AM)rob101 Wrote: days, hrs = hours//day, hours%day A shorter way
days, hrs = divmod(hours, day)
Skaperen and rob101 like this post
|