Skip to content
Related Articles

Related Articles

Improve Article

Python – Move() function in wxPython

  • Last Updated : 10 May, 2020

In this particular article we will learn, how can we move our window to a particular point. This can be achieved using Move() function in wx.Window class of wxPython.
Move() takes x and y points to move window to a particularx, y point.

Syntax :

wx.Move(self, x, y, flags=SIZE_USE_EXISTING)

Parameters :

ParameterInput TypeDescription
xintRequired x position.
yintRequired y position.
flagintflag for SetSize.

Code Example #1:




# import wxPython
import wx
  
# frame class
class MoveWindow(wx.Frame):
  
    def __init__(self, parent, title):
        super(MoveWindow, self).__init__(parent, title = title,
            size =(300, 200))
        # move window using Move() function
        self.Move((500, 250))
  
  
def  main():
    app = wx.App()
    move = MoveWindow(None, title ='Move()')
    move.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()

Output:



Code Example #2:




# import wxPython
import wx
  
# frame class
class MoveWindow(wx.Frame):
  
    def __init__(self, parent, title):
        super(MoveWindow, self).__init__(parent, title = title,
            size =(300, 200))
        # move window to (900, 600) using Move() function
        self.Move((900, 600))
  
  
def  main():
    app = wx.App()
    move = MoveWindow(None, title ='Move()')
    move.Show()
    app.MainLoop()
  
  
if __name__ == '__main__':
    main()

Output:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :