import sys

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class MyDialog(QDialog):
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setFocusPolicy(Qt.StrongFocus)
        label = QLabel(self)
        label.setText("World")
        hbox = QHBoxLayout()
        hbox.addWidget(label)
        self.setLayout(hbox)

class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.my_dialog = MyDialog()
        #self.my_dialog = MyDialog(self)
        label = QLabel(self)
        label.setText("Hello")
        self.setCentralWidget(label)
        shortcut = QShortcut(QKeySequence(Qt.Key_Tab), self, self.show_my_dialog)
        shortcut.setContext(Qt.ApplicationShortcut)
        self.show()
    def show_my_dialog(self):
        md = self.my_dialog
        if md.isVisible():
            md.hide()
            print 'hide'
        else:
            md.show()
            print 'show'

def main():
    app = QApplication([])
    main_window = MainWindow()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()
