364,111 Members | 2011 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

How to Change Display Screen Resolution? (800x600)

murathan
P: 4
How to Change Screen Resolution ?
Jun 10 '07 #1
Share this Question
Share on Google+
9 Replies


bartonc
Expert 5K+
P: 5,734
How to Change Screen Resolution ?
The maximum screen resolution depends on your hardware.
A program may be run in DOS mode. That may be what you are looking for.
Please tell us more about your system and what you are trying to do.

Thanks for joining.
Jun 10 '07 #2

murathan
P: 4
Win/Mac/Linux Change Display Screen Resolution Settings = 800x600
Jun 10 '07 #3

epots9
Expert 100+
P: 1,113
to change the resolution of your desktop click:
Start->Control Panel->Display->Settings (tab)

then change the resolution there
Jun 10 '07 #4

bartonc
Expert 5K+
P: 5,734
Win/Mac/Linux Change Display Screen Resolution Settings = 800x600
This was moved from the Python forum because it looked like a window question.
I'll move it back if you are trying to control the screen resolution from python. But you must be clear about what you are trying to do and what you have done so far in this regard.
Jun 10 '07 #5

murathan
P: 4
I am sorry..i couldn't explain.
My English is not good..
How to change the desktop resolution via python?
Ex:
Expand|Select|Wrap|Line Numbers
  1. import os
  2. sistem=os.name
  3. if sistem=="nt"
  4.     #Change screen resolution for windows
  5.       ChangeResolution = 800x600
  6. elif sistem=="posix":
  7.     #Change screen resolution for unix-linux
  8.       ChangeResolution = 800x600
  9. ....
  10. ....
  11. else:
  12.     #Change screen resolution for mac 
  13.       ChangeResolution = 800x600
  14.  
vs..
Thanks..
Jun 10 '07 #6

bartonc
Expert 5K+
P: 5,734
I am sorry..i couldn't explain.
My English is not good..
How to change the desktop resolution via python?
Ex:
Expand|Select|Wrap|Line Numbers
  1. import os
  2. sistem=os.name
  3. if sistem=="nt"
  4.     #Change screen resolution for windows
  5.       ChangeResolution = 800x600
  6. elif sistem=="posix":
  7.     #Change screen resolution for unix-linux
  8.       ChangeResolution = 800x600
  9. ....
  10. ....
  11. else:
  12.     #Change screen resolution for mac 
  13.       ChangeResolution = 800x600
  14.  
vs..
Thanks..
On Windows:
Do a google search for "Programmatically change display resolution".
Get that package working from the command line.
Then Python will be able to:
Expand|Select|Wrap|Line Numbers
  1. os.system("chscrres 800 600")
Although, I don't think is't a good idea for a program to change the screen resolution.
Jun 10 '07 #7

murathan
P: 4
:(
ok.
Google>> http://mail.python.org/pipermail/tut...er/051106.html
Ex:
Expand|Select|Wrap|Line Numbers
  1. import os, sys
  2.  
  3. import win32api
  4. import win32con
  5. import pywintypes
  6.  
  7. display_modes = {}
  8. n = 0
  9. while True:
  10.   try:
  11.     devmode = win32api.EnumDisplaySettings (None, n)
  12.   except pywintypes.error:
  13.     break
  14.   else:
  15.     key = (
  16.       devmode.BitsPerPel, 
  17.       devmode.PelsWidth, 
  18.       devmode.PelsHeight, 
  19.       devmode.DisplayFrequency
  20.     )
  21.     display_modes[key] = devmode
  22.     n += 1
  23.  
  24. mode_required = (32, 1600, 1280, 70)
  25. devmode = display_modes[mode_required]
  26. win32api.ChangeDisplaySettings (devmode, 0)
  27.  
  28. #
  29. # ... time passes
  30. #
  31.  
  32. mode_required = (32, 1280, 1024, 70)
  33. devmode = display_modes[mode_required]
  34. win32api.ChangeDisplaySettings (devmode, 0)
  35.  
Error:
"exceptions.keyError:(32, 1600, 1280, 70)"
Jun 11 '07 #8

bartonc
Expert 5K+
P: 5,734
:(
ok.
Google>> http://mail.python.org/pipermail/tut...er/051106.html
Ex:
Expand|Select|Wrap|Line Numbers
  1. import os, sys
  2.  
  3. import win32api
  4. import win32con
  5. import pywintypes
  6.  
  7. display_modes = {}
  8. n = 0
  9. while True:
  10.   try:
  11.     devmode = win32api.EnumDisplaySettings (None, n)
  12.   except pywintypes.error:
  13.     break
  14.   else:
  15.     key = (
  16.       devmode.BitsPerPel, 
  17.       devmode.PelsWidth, 
  18.       devmode.PelsHeight, 
  19.       devmode.DisplayFrequency
  20.     )
  21.     display_modes[key] = devmode
  22.     n += 1
  23.  
  24. mode_required = (32, 1600, 1280, 70)
  25. devmode = display_modes[mode_required]
  26. win32api.ChangeDisplaySettings (devmode, 0)
  27.  
  28. #
  29. # ... time passes
  30. #
  31.  
  32. mode_required = (32, 1280, 1024, 70)
  33. devmode = display_modes[mode_required]
  34. win32api.ChangeDisplaySettings (devmode, 0)
  35.  
Error:
"exceptions.keyError:(32, 1600, 1280, 70)"
Expand|Select|Wrap|Line Numbers
  1. n = 0
  2. while True:
  3.   try:
  4.     devmode = win32api.EnumDisplaySettings (None, n)
  5.   except pywintypes.error:
  6.     break
  7.   else:
  8.     key = (
  9.       devmode.BitsPerPel, 
  10.       devmode.PelsWidth, 
  11.       devmode.PelsHeight, 
  12.       devmode.DisplayFrequency
  13.     )
  14.     display_modes[key] = devmode
  15.     n += 1
You now have a dictionary [display_modes], keyed on the
height, width and depth needed.
You'll want to print the dictionary to see what modes that your system is actually capable of:
Expand|Select|Wrap|Line Numbers
  1. for item in display_modes.items():
  2.     print item
Jun 11 '07 #9

Motoma
Expert 2.5K+
P: 2,649
How to Change Screen Resolution ?
It seems there is a small amount of ambiguity in what you are try to accomplish. Perhaps you could be more thorough in explaining what you want to do (not just change screen resolution, try insteas change screen resolution for a game, change default desktop resolution for....etc)
Jun 12 '07 #10

Post your reply

Help answer this question



Didn't find the answer to your Python question?

You can also browse similar questions: Python