打开文件-执行功能 [英] Opening file - Performing a function

查看:41
本文介绍了打开文件-执行功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以指导我如何向文件赋予功能...这有点难以解释,所以我会尽力而为.
假设我有一个应用程序(使用wxPython),并假设我有一个文件.现在,此文件已分配为与应用程序一起打开.因此,我双击该文件,它将打开应用程序.现在我的问题是,要打开一个对话框,必须在文件上写些什么?因此,我们双击该文件,它会在应用程序上打开一个对话框?

I was wondering if someone could give me a direction on how to give functions to a file... This is a bit hard to explain, so I'll try my best.
Let's say I have an application (using wxPython) and let's say that I have a file. Now this file is assigned to open with the application. So, I double-click the file and it opens the application. Now my question is, what would have to be written on the file to, for example, open up a dialog? So we double-click the file and it opens a dialog on the application?

PS:我知道我必须先将该程序与某个文件类型相关联才能双击它,但这不是问题所在.

PS: I know that I have first to associate the program with a certain file type to double-click it, but thats not the question.

推荐答案

AFAIK大多数平台只将您单击的文件作为参数调用帮助程序,因此您的文件路径将位于 sys.argv [1]中.

AFAIK most platforms just call the helper app with the file you clicked on as an argument, so your filepath will be in sys.argv[1]

这篇关于打开文件-执行功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆