Python win32con.SW_SHOW() Examples

The following are code examples for showing how to use win32con.SW_SHOW(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: ironpython2   Author: IronLanguages   File: debugger.py    Apache License 2.0 6 votes vote down vote up
def GUIAboutToInteract(self):
		"Called as the GUI is about to perform any interaction with the user"
		frame = win32ui.GetMainFrame()
		# Remember the enabled state of our main frame
		# may be disabled primarily if a modal dialog is displayed.
		# Only get at enabled via GetWindowLong.
		self.bFrameEnabled = frame.IsWindowEnabled()
		self.oldForeground = None
		fw = win32ui.GetForegroundWindow()
		if fw is not frame:
			self.oldForeground = fw
#			fw.EnableWindow(0) Leave enabled for now?
			self.oldFrameEnableState = frame.IsWindowEnabled()
			frame.EnableWindow(1)
		if self.inForcedGUI and not frame.IsWindowVisible():
			frame.ShowWindow(win32con.SW_SHOW)
			frame.UpdateWindow()
		if self.curframe:
			SetInteractiveContext(self.curframe.f_globals, self.curframe.f_locals)
		else:
			SetInteractiveContext(None, None)
		self.GUIRespondDebuggerData() 
Example 2
Project: ironpython2   Author: IronLanguages   File: document.py    Apache License 2.0 6 votes vote down vote up
def _UpdateUIForState(self):
		"""Change the title to reflect the state of the document - 
		eg ReadOnly, Dirty, etc
		"""
		filename = self.GetPathName()
		if not filename: return # New file - nothing to do
		try:
			# This seems necessary so the internal state of the window becomes
			# "visible".  without it, it is still shown, but certain functions
			# (such as updating the title) dont immediately work?
			self.GetFirstView().ShowWindow(win32con.SW_SHOW)
			title = win32ui.GetFileTitle(filename)
		except win32ui.error:
			title = filename
		if self._IsReadOnly():
			title = title + " (read-only)"
		self.SetTitle(title) 
Example 3
Project: open-recipe   Author: dspray95   File: debugger.py    The Unlicense 6 votes vote down vote up
def GUIAboutToInteract(self):
		"Called as the GUI is about to perform any interaction with the user"
		frame = win32ui.GetMainFrame()
		# Remember the enabled state of our main frame
		# may be disabled primarily if a modal dialog is displayed.
		# Only get at enabled via GetWindowLong.
		self.bFrameEnabled = frame.IsWindowEnabled()
		self.oldForeground = None
		fw = win32ui.GetForegroundWindow()
		if fw is not frame:
			self.oldForeground = fw
#			fw.EnableWindow(0) Leave enabled for now?
			self.oldFrameEnableState = frame.IsWindowEnabled()
			frame.EnableWindow(1)
		if self.inForcedGUI and not frame.IsWindowVisible():
			frame.ShowWindow(win32con.SW_SHOW)
			frame.UpdateWindow()
		if self.curframe:
			SetInteractiveContext(self.curframe.f_globals, self.curframe.f_locals)
		else:
			SetInteractiveContext(None, None)
		self.GUIRespondDebuggerData() 
Example 4
Project: open-recipe   Author: dspray95   File: document.py    The Unlicense 6 votes vote down vote up
def _UpdateUIForState(self):
		"""Change the title to reflect the state of the document - 
		eg ReadOnly, Dirty, etc
		"""
		filename = self.GetPathName()
		if not filename: return # New file - nothing to do
		try:
			# This seems necessary so the internal state of the window becomes
			# "visible".  without it, it is still shown, but certain functions
			# (such as updating the title) dont immediately work?
			self.GetFirstView().ShowWindow(win32con.SW_SHOW)
			title = win32ui.GetFileTitle(filename)
		except win32ui.error:
			title = filename
		if self._IsReadOnly():
			title = title + " (read-only)"
		self.SetTitle(title) 
Example 5
Project: Rider-PPO   Author: YoongiKim   File: show_window.py    MIT License 6 votes vote down vote up
def enumHandler(hwnd, lParam):
    if win32gui.IsWindowVisible(hwnd):
        if 'BlueStacks' in win32gui.GetWindowText(hwnd):
            win32gui.ShowWindow(hwnd, win32con.SW_SHOW)
            win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW) 
Example 6
Project: apptools   Author: timeyyy   File: pidutil.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def show_window(value):
    if os.name == 'nt':
        HWND = value
        win32gui.ShowWindow(HWND, win32con.SW_RESTORE)
        win32gui.SetWindowPos(HWND,win32con.HWND_NOTOPMOST, 0, 0, 0,0, win32con.SWP_NOMOVE + win32con.SWP_NOSIZE )
        win32gui.SetWindowPos(HWND,win32con.HWND_TOPMOST, 0, 0, 0,0,win32con.SWP_NOMOVE + win32con.SWP_NOSIZE )
        win32gui.SetWindowPos(HWND,win32con.HWND_NOTOPMOST, 0, 0, 0,0,win32con.SWP_SHOWWINDOW + win32con.SWP_NOMOVE + win32con.SWP_NOSIZE)
        #~ win32gui.ShowWindow(hWnd,win32con.SW_SHOW); 
        #~ win32gui.BringWindowToTop(hWnd);
        #~ win32gui.SetForegroundWindow(hWnd);
        #http://stackoverflow.com/questions/6312627/windows-7-how-to-bring-a-window-to-the-front-no-matter-what-other-window-has-fo
        #http://timgolden.me.uk/pywin32-docs/win32gui__SetWindowPos_meth.html
        #~ //-- on Windows 7, this workaround brings window to top
        #~ win32gui.SetWindowPos(hWnd,HWND_NOTOPMOST,0,0,0,0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE);
        #~ win32gui.SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,win32con.SWP_NOMOVE | win32con.SWP_NOSIZE);
        #~ win32gui.SetWindowPos(hWnd,HWND_NOTOPMOST,0,0,0,0,win32con.SWP_SHOWWINDOW | win32con.SWP_NOMOVE | win32con.SWP_NOSIZE);
    else:
        name = value
        cmd = ['xdotool','search','--name','--onlyvisible', name,'windowactivate']
        args = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate() 
Example 7
Project: arkScript   Author: akbchris   File: debugger.py    MIT License 6 votes vote down vote up
def GUIAboutToInteract(self):
		"Called as the GUI is about to perform any interaction with the user"
		frame = win32ui.GetMainFrame()
		# Remember the enabled state of our main frame
		# may be disabled primarily if a modal dialog is displayed.
		# Only get at enabled via GetWindowLong.
		self.bFrameEnabled = frame.IsWindowEnabled()
		self.oldForeground = None
		fw = win32ui.GetForegroundWindow()
		if fw is not frame:
			self.oldForeground = fw
#			fw.EnableWindow(0) Leave enabled for now?
			self.oldFrameEnableState = frame.IsWindowEnabled()
			frame.EnableWindow(1)
		if self.inForcedGUI and not frame.IsWindowVisible():
			frame.ShowWindow(win32con.SW_SHOW)
			frame.UpdateWindow()
		if self.curframe:
			SetInteractiveContext(self.curframe.f_globals, self.curframe.f_locals)
		else:
			SetInteractiveContext(None, None)
		self.GUIRespondDebuggerData() 
Example 8
Project: arkScript   Author: akbchris   File: document.py    MIT License 6 votes vote down vote up
def _UpdateUIForState(self):
		"""Change the title to reflect the state of the document - 
		eg ReadOnly, Dirty, etc
		"""
		filename = self.GetPathName()
		if not filename: return # New file - nothing to do
		try:
			# This seems necessary so the internal state of the window becomes
			# "visible".  without it, it is still shown, but certain functions
			# (such as updating the title) dont immediately work?
			self.GetFirstView().ShowWindow(win32con.SW_SHOW)
			title = win32ui.GetFileTitle(filename)
		except win32ui.error:
			title = filename
		if self._IsReadOnly():
			title = title + " (read-only)"
		self.SetTitle(title) 
Example 9
Project: Advanced-Action-Scheduler   Author: swprojects   File: windowmanager.py    GNU General Public License v2.0 5 votes vote down vote up
def MaximizeWindow(handle):
    win32gui.ShowWindow(handle, win32con.SW_SHOW) 
Example 10
Project: Advanced-Action-Scheduler   Author: swprojects   File: windowmanager.py    GNU General Public License v2.0 5 votes vote down vote up
def ShowWindow(handle):
    win32gui.ShowWindow(handle, win32con.SW_SHOW) 
Example 11
Project: ironpython2   Author: IronLanguages   File: regedit.py    Apache License 2.0 5 votes vote down vote up
def EditValue(self, item):
		# Edit the current value
		class EditDialog(dialog.Dialog):
			def __init__(self, item):
				self.item = item
				dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT)
			def OnInitDialog(self):
				self.SetWindowText("Enter new value")
				self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW)
				self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
				# Modify the edit windows style
				style = win32api.GetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE)
				style = style & (~win32con.ES_WANTRETURN)
				win32api.SetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style)
				self.edit.SetWindowText(str(self.item))
				self.edit.SetSel(-1)
				return dialog.Dialog.OnInitDialog(self)
			def OnDestroy(self,msg):
				self.newvalue = self.edit.GetWindowText()
		
		try:
			index = self.GetNextItem(-1, commctrl.LVNI_SELECTED)
		except win32ui.error:
			return # No item selected.

		if index==0:
			keyVal = ""
		else:
			keyVal = self.GetItemText(index,0)
		# Query for a new value.
		try:
			newVal = self.GetItemsCurrentValue(item, keyVal)
		except TypeError, details:
			win32ui.MessageBox(details)
			return 
Example 12
Project: ironpython2   Author: IronLanguages   File: help.py    Apache License 2.0 5 votes vote down vote up
def OpenHelpFile(fileName, helpCmd = None, helpArg = None):
	"Open a help file, given a full path"
	# default help arg.
	win32ui.DoWaitCursor(1)
	try:
		if helpCmd is None: helpCmd = win32con.HELP_CONTENTS
		ext = os.path.splitext(fileName)[1].lower()
		if ext == ".hlp":
			win32api.WinHelp( win32ui.GetMainFrame().GetSafeHwnd(), fileName, helpCmd, helpArg)
		# XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts
		# so we disable it, forcing ShellExecute, which works fine (but
		# doesn't close the help file when Pythonwin is closed.
		# Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp,
		# which may or may not be related.
		elif 0 and ext == ".chm":
			import win32help
			global htmlhelp_handle
			helpCmd = html_help_command_translators.get(helpCmd, helpCmd)
			#frame = win32ui.GetMainFrame().GetSafeHwnd()
			frame = 0 # Dont want it overlapping ours!
			if htmlhelp_handle is None:
				htmlhelp_hwnd, htmlhelp_handle = win32help.HtmlHelp(frame, None, win32help.HH_INITIALIZE)
			win32help.HtmlHelp(frame, fileName, helpCmd, helpArg)
		else:
			# Hope that the extension is registered, and we know what to do!
			win32api.ShellExecute(0, "open", fileName, None, "", win32con.SW_SHOW)
		return fileName
	finally:
		win32ui.DoWaitCursor(-1) 
Example 13
Project: ironpython2   Author: IronLanguages   File: ietoolbar.py    Apache License 2.0 5 votes vote down vote up
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE) 
Example 14
Project: open-recipe   Author: dspray95   File: help.py    The Unlicense 5 votes vote down vote up
def OpenHelpFile(fileName, helpCmd = None, helpArg = None):
	"Open a help file, given a full path"
	# default help arg.
	win32ui.DoWaitCursor(1)
	try:
		if helpCmd is None: helpCmd = win32con.HELP_CONTENTS
		ext = os.path.splitext(fileName)[1].lower()
		if ext == ".hlp":
			win32api.WinHelp( win32ui.GetMainFrame().GetSafeHwnd(), fileName, helpCmd, helpArg)
		# XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts
		# so we disable it, forcing ShellExecute, which works fine (but
		# doesn't close the help file when Pythonwin is closed.
		# Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp,
		# which may or may not be related.
		elif 0 and ext == ".chm":
			import win32help
			global htmlhelp_handle
			helpCmd = html_help_command_translators.get(helpCmd, helpCmd)
			#frame = win32ui.GetMainFrame().GetSafeHwnd()
			frame = 0 # Dont want it overlapping ours!
			if htmlhelp_handle is None:
				htmlhelp_hwnd, htmlhelp_handle = win32help.HtmlHelp(frame, None, win32help.HH_INITIALIZE)
			win32help.HtmlHelp(frame, fileName, helpCmd, helpArg)
		else:
			# Hope that the extension is registered, and we know what to do!
			win32api.ShellExecute(0, "open", fileName, None, "", win32con.SW_SHOW)
		return fileName
	finally:
		win32ui.DoWaitCursor(-1) 
Example 15
Project: open-recipe   Author: dspray95   File: ietoolbar.py    The Unlicense 5 votes vote down vote up
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE) 
Example 16
Project: pyty   Author: howardjohn   File: window_api.py    GNU General Public License v3.0 5 votes vote down vote up
def focus_window(hwnd):
    """
    Focuses the given window.

    Args:
        hwnd (int): The window handler.
    """
    wg.ShowWindow(hwnd, wc.SW_SHOW)
    wg.ShowWindow(hwnd, wc.SW_SHOWNOACTIVATE)
    wg.SetForegroundWindow(hwnd) 
Example 17
Project: arkScript   Author: akbchris   File: help.py    MIT License 5 votes vote down vote up
def OpenHelpFile(fileName, helpCmd = None, helpArg = None):
	"Open a help file, given a full path"
	# default help arg.
	win32ui.DoWaitCursor(1)
	try:
		if helpCmd is None: helpCmd = win32con.HELP_CONTENTS
		ext = os.path.splitext(fileName)[1].lower()
		if ext == ".hlp":
			win32api.WinHelp( win32ui.GetMainFrame().GetSafeHwnd(), fileName, helpCmd, helpArg)
		# XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts
		# so we disable it, forcing ShellExecute, which works fine (but
		# doesn't close the help file when Pythonwin is closed.
		# Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp,
		# which may or may not be related.
		elif 0 and ext == ".chm":
			import win32help
			global htmlhelp_handle
			helpCmd = html_help_command_translators.get(helpCmd, helpCmd)
			#frame = win32ui.GetMainFrame().GetSafeHwnd()
			frame = 0 # Dont want it overlapping ours!
			if htmlhelp_handle is None:
				htmlhelp_hwnd, htmlhelp_handle = win32help.HtmlHelp(frame, None, win32help.HH_INITIALIZE)
			win32help.HtmlHelp(frame, fileName, helpCmd, helpArg)
		else:
			# Hope that the extension is registered, and we know what to do!
			win32api.ShellExecute(0, "open", fileName, None, "", win32con.SW_SHOW)
		return fileName
	finally:
		win32ui.DoWaitCursor(-1) 
Example 18
Project: arkScript   Author: akbchris   File: ietoolbar.py    MIT License 5 votes vote down vote up
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE) 
Example 19
Project: PyQt   Author: PyQt5   File: EmbedWindow.py    GNU General Public License v3.0 5 votes vote down vote up
def restore(self):
        """归还窗口"""
        # 有bug,归还后窗口没有了WS_VISIBLE样式,不可见
        widget = self.layout().itemAt(3).widget()
        print('restore', widget.hwnd, widget.style, widget.exstyle)
        win32gui.SetParent(widget.hwnd, widget.phwnd)  # 让它返回它的父窗口
        win32gui.SetWindowLong(
            widget.hwnd, win32con.GWL_STYLE, widget.style | win32con.WS_VISIBLE)  # 恢复样式
        win32gui.SetWindowLong(
            widget.hwnd, win32con.GWL_EXSTYLE, widget.exstyle)  # 恢复样式
        win32gui.ShowWindow(
            widget.hwnd, win32con.SW_SHOW)  # 显示窗口
        widget.close()
        self.layout().removeWidget(widget)  # 从布局中移出
        widget.deleteLater() 
Example 20
Project: wexpect   Author: raczben   File: wexpect.py    MIT License 5 votes vote down vote up
def interact(self):
        """Displays the child console for interaction."""
    
        self.switchTo()
        try:
            win32gui.ShowWindow(win32console.GetConsoleWindow(), win32con.SW_SHOW)
        finally:
            self.switchBack() 
Example 21
Project: open-recipe   Author: dspray95   File: regedit.py    The Unlicense 4 votes vote down vote up
def EditValue(self, item):
		# Edit the current value
		class EditDialog(dialog.Dialog):
			def __init__(self, item):
				self.item = item
				dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT)
			def OnInitDialog(self):
				self.SetWindowText("Enter new value")
				self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW)
				self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
				# Modify the edit windows style
				style = win32api.GetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE)
				style = style & (~win32con.ES_WANTRETURN)
				win32api.SetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style)
				self.edit.SetWindowText(str(self.item))
				self.edit.SetSel(-1)
				return dialog.Dialog.OnInitDialog(self)
			def OnDestroy(self,msg):
				self.newvalue = self.edit.GetWindowText()
		
		try:
			index = self.GetNextItem(-1, commctrl.LVNI_SELECTED)
		except win32ui.error:
			return # No item selected.

		if index==0:
			keyVal = ""
		else:
			keyVal = self.GetItemText(index,0)
		# Query for a new value.
		try:
			newVal = self.GetItemsCurrentValue(item, keyVal)
		except TypeError as details:
			win32ui.MessageBox(details)
			return
		
		d = EditDialog(newVal)
		if d.DoModal()==win32con.IDOK:
			try:
				self.SetItemsCurrentValue(item, keyVal, d.newvalue)
			except win32api.error as exc:
				win32ui.MessageBox("Error setting value\r\n\n%s" % exc.strerror)
			self.UpdateForRegItem(item) 
Example 22
Project: arkScript   Author: akbchris   File: regedit.py    MIT License 4 votes vote down vote up
def EditValue(self, item):
		# Edit the current value
		class EditDialog(dialog.Dialog):
			def __init__(self, item):
				self.item = item
				dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT)
			def OnInitDialog(self):
				self.SetWindowText("Enter new value")
				self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW)
				self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
				# Modify the edit windows style
				style = win32api.GetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE)
				style = style & (~win32con.ES_WANTRETURN)
				win32api.SetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style)
				self.edit.SetWindowText(str(self.item))
				self.edit.SetSel(-1)
				return dialog.Dialog.OnInitDialog(self)
			def OnDestroy(self,msg):
				self.newvalue = self.edit.GetWindowText()
		
		try:
			index = self.GetNextItem(-1, commctrl.LVNI_SELECTED)
		except win32ui.error:
			return # No item selected.

		if index==0:
			keyVal = ""
		else:
			keyVal = self.GetItemText(index,0)
		# Query for a new value.
		try:
			newVal = self.GetItemsCurrentValue(item, keyVal)
		except TypeError as details:
			win32ui.MessageBox(details)
			return
		
		d = EditDialog(newVal)
		if d.DoModal()==win32con.IDOK:
			try:
				self.SetItemsCurrentValue(item, keyVal, d.newvalue)
			except win32api.error as exc:
				win32ui.MessageBox("Error setting value\r\n\n%s" % exc.strerror)
			self.UpdateForRegItem(item)