当我运行脚本时,主窗体会弹出最大化(即占用屏幕上的所有空间)。我试图使用CSS文件设置表单的高度和宽度,但是没有成功。我在别的地方没看到过。在
我的代码是:
import sys
import pyforms
from pyforms import BaseWidget
from pyforms.Controls import ControlText
from pyforms.Controls import ControlButton
from pyforms.Controls import ControlFile
class ImportIntoFile(BaseWidget):
def __init__(self):
super(ImportIntoFile,self).__init__('HTCondor & EnergyPlus')
self._Input = ControlFile('Input')
self._Output = ControlFile('Output')
self._Import = ControlButton('Import')
self._Close = ControlButton('Close')
self._formset = ['',(' ','_Input',' '),(' ','_Output',' '),('','_Close','','_Import',''),'']
self._Import.value = self.__ImportAction
self._Close.value = self.__CloseAction
def __ImportAction(self):
OutputFile = open(self._Output.value,'a')
InputFile = open(self._Input.value,'r')
OutputFile.close
InputFile.close
def __CloseAction(self):
sys.exit()
if __name__ == "__main__": pyforms.startApp( ImportIntoFile )`
我也有同样的问题。Pyforms使用Qt、so some of these modules will be familiar和this css will modify them。在
我用过:
要成功设置主窗口的大小,但以后不能再增加大小,所以如果您只需要一个固定大小的窗口,它就可以工作了。在
我也找不到好的解决办法。为了避免默认情况下最大化的临时解决方法,我所做的是修改C:\Python27\Lib\site packages\pyforms\gui\standaloneManager.py. 在
从
到
^{pr2}$您可以将窗口几何体传递给
pyforms.start_app()
调用。所以下面的代码应该可以工作。在相关问题 更多 >
编程相关推荐