简体   繁体   中英

convert my python code to windows application (right-click menu)

For example, I have written a code which gets an import folder directory and a destination folder, and rotates all images in the import folder by 45 degrees clockwise, and saves them rotated in the destination folder. It works great, but you must have python in order to use it. I want to have an option when you press right click on a folder, and then you can choose: rotate all images by 45 degrees. How can I do that?

  1. You can use PyInstaller to package your Python program into a stand-alone executable. http://www.pyinstaller.org
  2. Then, read the answer to this older question. It should give you more information on how to add Context Menus in the Windows File Explorer for specific file types: Add menu item to windows context menu only for specific filetype

With these 2 steps done, you'll have an EXE standalone Python application, and you'll be able to add shortcuts to using the app for specific file types or folders.

Good luck!

This is more related to Windows API then Python or whatever framework you are using.

Actually you can do something similar by:

  1. Freezing your code. You can choose any but I use cx_freeze .
  2. Package the app using Inno Setup. It provides some "shortcuts" to work with Windows, including context menu actions.
  3. You can use Inno Script Studio, which is an IDE for Inno Setup. It may help you setting up the context menu actions.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM