I wrote a function to save window size to a file using pythons functions but I have a problem reading it.I save
to a py file window size as a variable like this -‘resolution-value 800, 600’ and set window size like this - ‘wp.setSize(800, 600)’, but I use arg as an variable to change the resolution and save it to file, thats why I can only use it to read from file.But setSize() accepts only int and thats why I cant set window size like this ‘wp.setSize(arg)’.Maybe theres another way to do it.
resb = DirectOptionMenu(parent = options, scale = (0.1, 1, 0.15), items = ['800, 600', '1024, 768', '1152, 864', '1280, 960', '1280, 1024'], pos = (-1.3, 0, 0.4), command = self.resolution)
def resolution(self, arg):
cfgFile = open('Config.py').read()
resvar = 'resolution-value ' +arg
if arg == '800, 600':
wp.setSize(800, 600)
for arg in cfgFile:
resvar = resvar.replace('arg', '800, 600')
cfgFile = open('Config.py', 'w')
if arg == '1024, 768':
wp.setSize(1024, 768)
for arg in cfgFile:
resvar = resvar.replace('arg', '1024, 768')
cfgFile = open('Config.py', 'w')
if arg == '1152, 864':
wp.setSize(1152, 864)
for arg in cfgFile:
resvar = resvar.replace('arg', '1152, 864')
cfgFile = open('Config.py', 'w')
if arg == '1280, 960':
wp.setSize(1280, 960)
for arg in cfgFile:
resvar = resvar.replace('arg', '1280, 960')
cfgFile = open('Config.py', 'w')
if arg == '1280, 1024':
wp.setSize(1280, 1024)
for arg in cfgFile:
resvar = resvar.replace('arg', '1280, 1024')
cfgFile = open('Config.py', 'w')
cfgFile.write(resvar)
cfgFile.close()