Merge pull request #720 from MikeTheWatchGuy/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2018-11-14 09:14:16 -05:00 committed by GitHub
commit 5ac08aff56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 14 deletions

View File

@ -190,7 +190,6 @@ class MyWindows():
self.NumOpenWindows = 0 self.NumOpenWindows = 0
self.user_defined_icon = None self.user_defined_icon = None
self.hidden_master_root = None self.hidden_master_root = None
self.window_being_closed = None
def Decrement(self): def Decrement(self):
self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0 self.NumOpenWindows -= 1 * (self.NumOpenWindows != 0) # decrement if not 0
@ -1204,6 +1203,16 @@ class Output(Element):
print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***') print('*** form = sg.Window("My Form").Layout(layout).Finalize() ***')
return self._TKOut return self._TKOut
def Update(self, value=None):
if value is not None:
# try:
self._TKOut.output.delete('1.0', tk.END)
self._TKOut.output.insert(tk.END, value)
# except:
# pass
def __del__(self): def __del__(self):
try: try:
self._TKOut.__del__() self._TKOut.__del__()
@ -3236,7 +3245,6 @@ class Window:
global _my_windows global _my_windows
if self.DisableClose: if self.DisableClose:
return return
_my_windows.window_being_closed = self
# print('Got closing callback') # print('Got closing callback')
if self.CurrentlyRunningMainloop: # quit if this is the current mainloop, otherwise don't quit! if self.CurrentlyRunningMainloop: # quit if this is the current mainloop, otherwise don't quit!
self.TKroot.quit() # kick the users out of the mainloop self.TKroot.quit() # kick the users out of the mainloop

View File

@ -6,17 +6,31 @@ import textwrap
import pickle import pickle
import base64 import base64
import calendar import calendar
from PySide2.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QComboBox, QFormLayout, QVBoxLayout, \ try:
QHBoxLayout, QListWidget, QDial, QTableWidget from PyQt5.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QComboBox, QFormLayout, QVBoxLayout, \
from PySide2.QtWidgets import QSlider, QCheckBox, QRadioButton, QSpinBox, QPushButton, QTextEdit, QMainWindow, QDialog, QAbstractItemView QHBoxLayout, QListWidget, QDial, QTableWidget
from PySide2.QtWidgets import QSpacerItem, QFrame, QGroupBox, QTextBrowser, QPlainTextEdit, QButtonGroup, QFileDialog, QTableWidget, QTabWidget, QTabBar, QTreeWidget, QTreeWidgetItem, QLayout, QTreeWidgetItemIterator, QProgressBar from PyQt5.QtWidgets import QSlider, QCheckBox, QRadioButton, QSpinBox, QPushButton, QTextEdit, QMainWindow, QDialog, QAbstractItemView
# from PySide2.QtWidgets import from PyQt5.QtWidgets import QSpacerItem, QFrame, QGroupBox, QTextBrowser, QPlainTextEdit, QButtonGroup, QFileDialog, QTableWidget, QTabWidget, QTabBar, QTreeWidget, QTreeWidgetItem, QLayout, QTreeWidgetItemIterator, QProgressBar
from PySide2.QtWidgets import QTableWidgetItem, QGraphicsView, QGraphicsScene, QGraphicsItemGroup, QMenu, QMenuBar, QAction from PyQt5.QtWidgets import QTableWidgetItem, QGraphicsView, QGraphicsScene, QGraphicsItemGroup, QMenu, QMenuBar, QAction
from PySide2.QtGui import QPainter, QPixmap, QPen, QColor, QBrush, QPainterPath, QFont, QImage, QIcon from PyQt5.QtGui import QPainter, QPixmap, QPen, QColor, QBrush, QPainterPath, QFont, QImage, QIcon
from PySide2.QtCore import Qt,QProcess, QEvent from PyQt5.QtCore import Qt,QProcess, QEvent
import PySide2.QtGui as QtGui import PyQt5.QtGui as QtGui
import PySide2.QtCore as QtCore import PyQt5.QtCore as QtCore
import PySide2.QtWidgets as QtWidgets import PyQt5.QtWidgets as QtWidgets
using_pyqt5 = True
except:
from PySide2.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QComboBox, QFormLayout, QVBoxLayout, \
QHBoxLayout, QListWidget, QDial, QTableWidget
from PySide2.QtWidgets import QSlider, QCheckBox, QRadioButton, QSpinBox, QPushButton, QTextEdit, QMainWindow, QDialog, QAbstractItemView
from PySide2.QtWidgets import QSpacerItem, QFrame, QGroupBox, QTextBrowser, QPlainTextEdit, QButtonGroup, QFileDialog, QTableWidget, QTabWidget, QTabBar, QTreeWidget, QTreeWidgetItem, QLayout, QTreeWidgetItemIterator, QProgressBar
from PySide2.QtWidgets import QTableWidgetItem, QGraphicsView, QGraphicsScene, QGraphicsItemGroup, QMenu, QMenuBar, QAction
from PySide2.QtGui import QPainter, QPixmap, QPen, QColor, QBrush, QPainterPath, QFont, QImage, QIcon
from PySide2.QtCore import Qt,QProcess, QEvent
import PySide2.QtGui as QtGui
import PySide2.QtCore as QtCore
import PySide2.QtWidgets as QtWidgets
using_pyqt5 = False
""" """
The QT version if PySimpleGUI. The QT version if PySimpleGUI.
@ -4418,6 +4432,7 @@ def stop_timer(timer):
# ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----#
def StartupTK(window): def StartupTK(window):
global _my_windows global _my_windows
global using_pyqt5
ow = _my_windows.NumOpenWindows ow = _my_windows.NumOpenWindows
@ -4445,7 +4460,7 @@ def StartupTK(window):
flags |= QtCore.Qt.Tool flags |= QtCore.Qt.Tool
if window.KeepOnTop: if window.KeepOnTop:
flags |= Qt.WindowStaysOnTopHint flags |= Qt.WindowStaysOnTopHint
if flags is not None: if not using_pyqt5 and flags is not None:
window.QT_QMainWindow.setWindowFlags(flags) window.QT_QMainWindow.setWindowFlags(flags)
if window.AlphaChannel: if window.AlphaChannel:
window.QT_QMainWindow.setWindowOpacity(window.AlphaChannel) window.QT_QMainWindow.setWindowOpacity(window.AlphaChannel)