问题描述
我在Jython中编写了一个对象,以使用javaFX加载多个文件。由于结构非常“刚性”,我不知道如何在不破坏参数的情况下将参数传递给该对象。
import sys
from java.io import File
from java.nio.file import Paths
from javafx.application import Application
from javafx.stage import FileChooser,Stage
class filebrowser(Application):
@classmethod
def main(cls):
filebrowser.launch(cls)
@staticmethod
def getAbsPath(primaryStage):
fc = FileChooser()
fc.setinitialDirectory(
File(Paths.get(".").toAbsolutePath().normalize().toString())
)
return fc.showOpenMultipleDialog(primaryStage)
def start(self,primaryStage):
self.getAbsPath(primaryStage)
if __name__ == '__main__':
fb = filebrowser
fb.main()
例如,我希望可以将参数传递给函数setinitialDirectory
。
但是,传递的任何参数都可以放在start方法下很重要。
如果我使用构造函数def __init__(self)
,程序将中断。
所以我想知道...如何将参数传递给在start方法中读取的对象?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)