Python Forum
what have you learned recently?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what have you learned recently?
#1
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.
Reply
#2
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.
Reply
#3
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
Reply
#4
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.
Jan_97 likes this post
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
(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.
Reply
#6
(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.
Reply
#7
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'.
Reply
#8
Smile 
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
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'.
Reply
#9
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
Reply
#10
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  recently seen on another website Skaperen 1 2,240 Jul-20-2018, 09:34 PM
Last Post: nilamo
  Just learned that Unity is gone wavic 10 8,189 Apr-12-2017, 09:38 AM
Last Post: wavic
  first learned python metulburr 12 10,369 Jan-03-2017, 05:21 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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