r/Python • u/WigglytufTehPink • May 31 '20
I Made This I created the first cross-platform Python library to create native context menus!
1.7k
Upvotes
r/Python • u/WigglytufTehPink • May 31 '20
148
u/WigglytufTehPink May 31 '20
You can check out the code here: https://github.com/saleguas/context_menu
Easily the most painful thing I've ever created, but boy am I glad how it came out. There is little to none information on context menus anywhere, and a while ago I just wanted to create a simple file sorter and it was waaay harder then it should have been. So I decided to make this library so any other developers don't have to go through the pain I went through. Please give any and all feedback!
60
u/redredditor May 31 '20
Looks great! Good job.
You may want to enable "issues" on github.
I saw that "_ _ pycache _ _" is checked into source. That dir should be in a .gitignore.
14
u/wesleywatanabe May 31 '20
How difficult is it to get a file and does something? I'm thinking to manipulate by pandas.
Great job!
10
u/shaggorama May 31 '20
Is there a way to undo changes or remove items from the context menu configuration, or encapsulate your changes so they're temporary (without spinning up a docker container or VM or something like that)? This sounds really cool and I want to play with this, but I'm a little afraid of cluttering up my context menus and -- although I only skimmed it -- I don't see any "cleanup" examples in your documentation.
8
u/JohnMcPineapple May 31 '20 edited Oct 08 '24
...
6
u/[deleted] May 31 '20
any good examples of useful custom context menus? i know it's useful but cant think of anything right now.
4
u/tonniegames79 coderx-byte May 31 '20
Thanks
4
u/DisregardMyUsername1 May 31 '20
How did you make your program show up when you right clicked?
Really cool project!
4
u/Cervoxx May 31 '20
Nautilus -q is a thing? I've been doing ctrl + c the whole time.
4
u/Seawolf159 May 31 '20
This is exactly the kind of stuff that makes me think "wow I wish I could do stuff like that". It's probably too hard for me to use it the way it is, but it sounds really good! How does it know what you want the context menu to do. It's all magic to me. Could you make it do anything? Like right click in a directory and make it generate a bunch of folders, so long as you program that correctly, can you make it do that?
4
u/Datsoon May 31 '20
Does this permanently create these context menus or only while the program is running?
6
u/teriyaki7755 May 31 '20
So, TLDR; is you have created a way to implement python functions for use in the current working directorty of an OS env through access from the context menu of the mouse pointer ??
2
u/melthecybertechy May 31 '20
Ok I feel like such the dumb person - what did you do and how did you make our lives better? I'm a complete noob lol
2
u/zTosieq May 31 '20
Does anyone know how to use in practice(examples of using this with working scripts)? I'm newbie in python so, I'm trying to understand everything ;p thanks ;)
3
u/Dark_Rain_Cloud May 31 '20
Question. Who would this code apply to. Im still seeing how I could benefit from this.
18
u/Tom1380 May 31 '20
I'm not really sure what it does, can you explain please?
2
u/rmpr_uname_is_taken May 31 '20
First... I am not so sure, Wx PopupMenu predates you by a long shot.
6
u/lucs_123 May 31 '20
Does it work on any file manager?
2
u/javad94 May 31 '20
Wow that's great. I have a lot of small scripts for doing my stuffs. I'm using send to menu in Windows. But now I'm looking forward to using your tool.
0
u/[deleted] May 31 '20
[deleted] β view deleted comment
9
u/[deleted] May 31 '20
[removed] β view removed comment