views:

47

answers:

1

Why are the commands to change the window position before and after sleep(3.00) being ignored?

if self.selectedM.get() == 'Bump':
        W1 = GetSystemMetrics(1) + 200
        print W1
        w1.wm_geometry("+100+" + str(W1))
        w2.wm_geometry("+100+" + str(W1))
        w3.wm_geometry("+100+" + str(W1))
        w4.wm_geometry("+100+" + str(W1))
        self.rvar.set(0)
        self.rvar2.set(0)
        self.rvar3.set(0)
        self.rvar4.set(0)

        s = self.wm_geometry()
        geomPatt = re.compile(r"(\d+)?x?(\d+)?([+-])(\d+)([+-])(\d+)")

        m = geomPatt.search(s)
        X3 = m.group(4)
        Y3 = m.group(6)

        M = int(Y3) - 150

        P = M + 150


        MH = W1
        MUH = Y3


        while Y3 > M:
            sleep(0.0009)
            Y3 = int(Y3) - 1
            self.update_idletasks()
            self.wm_geometry("+" + str(X3) + "+" + str(Y3))
            print 1

        Alpha = 1.0
        #while 0.0 < Alpha :
         #   Alpha = Alpha - 0.01
          #  self.attributes("-alpha", Alpha)
           # sleep(0.005)




        self.wm_geometry("+" + str(X3) + "+" + str(MH))

        sleep(3.00)

        self.wm_geometry("+" + str(X3) + "+" + str(MUH))




        #while 1.0 > Alpha :
         #   Alpha = Alpha + 0.01
          #  self.attributes("-alpha", Alpha)
           # sleep(0.005)

        while Y3 < P:
            sleep(0.0009)
            Y3 = int(Y3) + 1
            self.update_idletasks()
            self.wm_geometry("+" + str(X3) + "+" + str(Y3))
+1  A: 

The answer to your question is that you don't give the system a chance to update the display. The display is updated by the event loop but you don't enter the event loop after either of the wm_geometry calls surrounding the sleep(3.00) call. They aren't being ignored, it's just that you're changing the geometry again before the system has a chance to update the display.

Does the answer to the question Having Trouble with Tkinter Transparency help you solve this problem too?

Bryan Oakley