Help save net neutrality! Learn more.
Close

Minimze/Maximize?

winkerbean
2006-04-11
2013-05-28
  • winkerbean

    winkerbean - 2006-04-11

    How would I click the minimize/maximize buttons using pywinauto?

    Thanks in advance.

     
    • Mark Mc Mahon

      Mark Mc Mahon - 2006-04-11

      Hi,

      There isn't a direct way at the moment :-(

      What you can do instead is to the following
      # get the contants and ShowWindow function
      from pywinauto.win32defines import SW_MAXIMIZE, SW_SHOW, SW_HIDE
      from pywinauto.win32functions import ShowWindow

      # this may be enough - it works for Notepad at least
      ShowWindow(app.YourDlg.handle, SW_MAXIMIZE)

      # if that didn't work then hide, maximize and show the window
      # you need to save the handle first because after the window is hidden - pywinauto will not find it by default (though it can be made to find it ;-)

      handle = app.YourDlg.handle

      ShowWindow(handle, SW_HIDE)
      ShowWindow(handle, SW_MAXIMIZE)
      ShowWindow(handle, SW_SHOW)

      Thanks
         Mark

       
      • winkerbean

        winkerbean - 2006-04-11

        Great!  I'll give it a try.  Thanks!

         

Log in to post a comment.