If a game written with python requires 1280 x 1024 can it be changed to 800 x 600?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jaroge01
    New Member
    • Mar 2010
    • 1

    If a game written with python requires 1280 x 1024 can it be changed to 800 x 600?

    If a game written with Python requires 1280 x 1024 ,can it be changed to 800 x 600?
    If it can be done please tell how.
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    I would say it depends on the code. A graphic object position can be scaled to fit on a Tkinter canvas as in:
    Code:
    canvas_pad = 20
    canvas_size = 400
    
    # Given a random point and a list of points representing a polygon selected in any
    # location in an XY plane, display the point and polygon on a canvas.
    
    # snip
    class PolygonDialog(object):
        def __init__(self, model, pt1, ptList, resultStr="NONE"):
            dlg1 = Dialog("Inside Polygon Test")
            self.dlg1 = dlg1
            mainFrame = Frame(dlg1)
            mainFrame.Pack(fill='both', expand=True)
            self.pt1 = Pt(pt1.x, pt1.y)
            self.ptList = [Pt(pt.x,pt.y) for pt in ptList]
            self.minX = min([pt.x for pt in ptList+[self.pt1,]])
            self.maxX = max([pt.x for pt in ptList+[self.pt1,]])
            self.minY = min([pt.y for pt in ptList+[self.pt1,]])
            self.maxY = max([pt.y for pt in ptList+[self.pt1,]])
            self.dimensions = self.maxX-self.minX, self.maxY-self.minY
            self.scale = canvas_size/max(self.dimensions)
            self.resultStr = resultStr
            # Subtract minX and minY and scale all points to fit in canvas_size
            for i, pt in enumerate(self.ptList):
                pt = Pt(pt.x, pt.y) - Pt(self.minX, self.minY)
                self.ptList[i] = (pt*self.scale)+Pt(canvas_pad,canvas_pad)
            self.pt1 = (Pt(pt1.x, pt1.y)-Pt(self.minX, self.minY))*self.scale+\
                       Pt(canvas_pad,canvas_pad)
            self.canvas(mainFrame, model)
    # snip

    Comment

    Working...