Python Forum
what have you learned recently? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Bar (https://python-forum.io/forum-27.html)
+--- Thread: what have you learned recently? (/thread-37195.html)

Pages: 1 2


what have you learned recently? - Skaperen - May-10-2022

what have you learned recently that impacts your programming in Python or anything else you regularly do?


RE: what have you learned recently? - Skaperen - May-11-2022

so, what you learn (if anything) does not affect what you do, either at work, or at home, or anywhere else?


RE: what have you learned recently? - Jan_97 - Jul-18-2022

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 Big Grin


RE: what have you learned recently? - Skaperen - Jul-19-2022

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.


RE: what have you learned recently? - Jan_97 - Jul-20-2022

(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.


RE: what have you learned recently? - Skaperen - Jul-21-2022

(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.


RE: what have you learned recently? - Gribouillis - Aug-17-2022

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'.


RE: what have you learned recently? - DPaul - Sep-01-2022

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. Cool
Paul


RE: what have you learned recently? - rob101 - Sep-01-2022

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



RE: what have you learned recently? - Gribouillis - Sep-01-2022

(Sep-01-2022, 06:54 AM)rob101 Wrote: days, hrs = hours//day, hours%day
A shorter way
days, hrs = divmod(hours, day)