本文整理汇总了Python中PyQt4.QtDeclarative.QDeclarativeView.setGeometry方法的典型用法代码示例。如果您正苦于以下问题:Python QDeclarativeView.setGeometry方法的具体用法?Python QDeclarativeView.setGeometry怎么用?Python QDeclarativeView.setGeometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtDeclarative.QDeclarativeView
的用法示例。
在下文中一共展示了QDeclarativeView.setGeometry方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
def main():
# Main function to be executed while running the program
# Generate QML View
app = QApplication(sys.argv)
view = QDeclarativeView()
view.setSource(QUrl('Fingers.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Get Root Object for communication
global rootObject
rootObject = view.rootObject()
# Connect to start Leap signal
rootObject.qmlStarted.connect(startLeap)
# Connect to stop Leap signal
rootObject.qmlStop.connect(stopLeap)
# Display the component
import subprocess
output = subprocess.Popen('xrandr | grep "\*" | cut -d" " -f4',shell=True, stdout=subprocess.PIPE).communicate()[0]
output = output[:-1]
screenX = output[:output.index('x')]
screenY = output[output.index('x')+1:]
view.setGeometry(100, 100, int(screenX), int(screenY))
view.show()
app.exec_()
示例2: run
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
def run(self):
app = QApplication(sys.argv)
imageProvider = ImageProvider()
# Create the QML user interface.
view = QDeclarativeView()
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
engine = view.engine()
engine.addImageProvider("mazakodron", imageProvider)
view.setSource(QUrl('symulator/mazakodron.qml'))
rootObject = view.rootObject()
if not rootObject:
view.setSource(QUrl('mazakodron.qml'))
rootObject = view.rootObject()
rootObject.requestDraw.connect(imageProvider.draw)
self.rootObject = rootObject
view.setGeometry(0, 0, 800, 600)
view.show()
timer = QTimer()
timer.start(1000/60) # 60FPS
timer.timeout.connect(self.process)
sys.exit(app.exec_());
示例3: main
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
def main():
app = QApplication(sys.argv)
stack = Stack()
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('stack.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setWindowTitle(u'栈')
# Get the root object of the user interface. It defines a
# 'messageRequired' signal and JavaScript 'updateMessage' function. Both
# can be accessed transparently from Python.
rootObject = view.rootObject()
# Provide the current date and time when requested by the user interface.
rootObject.button_clicked.connect(stack.push)
# Update the user interface with the current date and time.
stack.push_element.connect(rootObject.first_clicked)
# Provide an initial message as a prompt.
#rootObject.updateMessage(u"转眼间,你我已相遇...")
stack.push(2)
# Display the user interface and allow the user to interact with it.
view.setGeometry(80, 80, 960, 580)
view.show()
app.exec_()
示例4: main
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
def main():
app = QApplication(sys.argv)
now = Now()
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('meet.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setWindowTitle(u'属于你我的时间')
# Get the root object of the user interface. It defines a
# 'messageRequired' signal and JavaScript 'updateMessage' function. Both
# can be accessed transparently from Python.
rootObject = view.rootObject()
# Provide the current date and time when requested by the user interface.
rootObject.messageRequired.connect(now.emit_now)
# Update the user interface with the current date and time.
now.now.connect(rootObject.updateMessage)
timer = QTimer()
timer.timeout.connect(now.emit_now)
timer.start(500)
# Provide an initial message as a prompt.
rootObject.updateMessage(u"转眼间,你我已相遇...")
# Display the user interface and allow the user to interact with it.
view.setGeometry(80, 80, 960, 580)
view.show()
app.exec_()
示例5: create_dv
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
def create_dv():
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('qml/leonbmain.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Display the user interface and allow the user to interact with it.
view.setGeometry(100, 100, 400, 240)
view.show()
rootObject = view.rootObject()
return view
示例6: main
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
def main():
app = QApplication(sys.argv)
test = SignalTest()
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('Button.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
view.setWindowTitle(u'栈')
rootObject = view.rootObject()
rootObject.updateTextRequired.connect(test.change_text)
# Update the user interface with the current date and time.
test.signal_test.connect(rootObject.updateText)
# Provide an initial message as a prompt.
rootObject.updateText(u"转眼间,你我已相遇...")
#stack.push(2)
# Display the user interface and allow the user to interact with it.
view.setGeometry(80, 80, 960, 580)
view.show()
app.exec_()
示例7: MyQProcess
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
rootObject.saveFile.connect(saveFile)
rootObject.encodeCmd.connect(encodeCmd)
rootObject.abortEncode.connect(abortEncode)
rootObject.openLogClicked.connect(openLog)
# Set home dir in qml
rootObject.setHomeDir(home)
# Create encode process
cmdProcess = MyQProcess()
QObject.connect(cmdProcess,SIGNAL("finished(int)"),cmdProcess,SLOT("finishEncode()"))
QObject.connect(cmdProcess,SIGNAL("readyReadStandardOutput()"),cmdProcess,SLOT("readStdOutput()"))
QObject.connect(cmdProcess,SIGNAL("readyReadStandardError()"),cmdProcess,SLOT("readStdError()"))
QObject.connect(cmdProcess,SIGNAL("error()"),cmdProcess,SLOT("errorEncode()"))
# Outputfile
outputfile = QString("empty")
# Display the user interface and allow the user to interact with it.
view.setGeometry(0, 0, 480, 575)
view.setFixedSize(480, 575)
view.setWindowTitle(QCoreApplication.translate(None, 'Encode'))
screen = QDesktopWidget().screenGeometry()
size = view.geometry()
view.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
view.show()
#view.showFullScreen()
app.exec_()
示例8: QApplication
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
self.now.emit(formatted_date)
app = QApplication(sys.argv)
now = Now()
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('message.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Get the root object of the user interface. It defines a
# 'messageRequired' signal and JavaScript 'updateMessage' function. Both
# can be accessed transparently from Python.
rootObject = view.rootObject()
# Provide the current date and time when requested by the user interface.
rootObject.messageRequired.connect(now.emit_now)
# Update the user interface with the current date and time.
now.now.connect(rootObject.updateMessage)
# Provide an initial message as a prompt.
rootObject.updateMessage("Click to get the current date and time")
# Display the user interface and allow the user to interact with it.
view.setGeometry(100, 100, 400, 240)
view.show()
app.exec_()
示例9: Play
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
# def Play(self, mod):
# print ("Play " + self.filename + " " + mod)
app = QApplication(sys.argv)
# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('main.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
rootObject = view.rootObject()
#rootObject.updateSignal.connect(Update)
#sound.setPositionCallback(rootObject.updateProgress)
rootObject.updateSignal.connect(system.Update)
view.setGeometry(0, 0, rootObject.property("width"), rootObject.property("height"))
view.show()
for i in range(36):
rootObject.addElements()
def Print(index, mouse):
print("Clicked: " + str(index) + " " + str(mouse.property("x")) + " " + str(mouse.property("y")))
songs = []
j = 0
for c in range(10):
if (c >= 1 and c <= 8):
l = rootObject.getListContents(c)
for i in l:
j += 1
示例10: Infoboard
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
class Infoboard(object):
def __init__(self, schedule_dir):
self.schedule_dir = schedule_dir
self.videos = {}
self.playlist = []
self.app = QApplication(sys.argv)
self.view = QDeclarativeView()
self.view.setSource(QUrl('scene.qml'))
self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
self.viewRoot = self.view.rootObject()
self.viewRoot.quit.connect(self.app.quit)
self.viewRoot.finished.connect(self.show_next)
self.view.setGeometry(100, 100, 400, 240)
self.view.showFullScreen()
self.watcher = QFileSystemWatcher()
def schedule_dir_changed(self, filename):
self.process_all_schedules()
self.playlist = []
def run(self):
self.watcher.addPath(self.schedule_dir)
self.watcher.directoryChanged.connect(self.schedule_dir_changed)
self.process_all_schedules()
self.show_next()
self.app.exec_()
def process_schedule(self, key, fobj):
self.videos[key] = []
for line in fobj:
line = line.strip()
if (not line) or line.startswith('#'): continue
try:
self.videos[key].append(Video(line))
except:
pass
def process_all_schedules(self):
for filename in glob.glob(self.schedule_dir + '/*.txt'):
filename = os.path.abspath(filename)
with open(filename, 'rb') as f:
self.process_schedule(filename, f)
def show_next(self):
item = self.playlist_next()
if not item:
return
if item.type == 'image':
self.viewRoot.showImage(item.filename)
QTimer.singleShot(item.duration * 1000, self.show_next)
elif item.type == 'video':
self.viewRoot.showVideo(item.filename)
def playlist_next(self):
if len(self.playlist) == 0:
self.process_all_schedules()
today = date.today()
all_videos = []
for key in sorted(self.videos.keys()):
all_videos += self.videos[key]
self.playlist = [video for video in all_videos
if video.start_date <= today and video.end_date >= today]
if len(self.playlist) == 0:
return None
return self.playlist.pop(0)
示例11: QDeclarativeView
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
view = QDeclarativeView()
view.setSource(QUrl('resources/qml/main.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
# Get the root object of the user interface. It defines a
# 'updateSignal' signal and JavaScript 'updateMessage' function. Both
# can be accessed transparently from Python.
rootObject = view.rootObject()
# Provide the current date and time when requested by the user interface.
rootObject.updateSignal.connect(system.Update)
rootObject.newSound.connect(printer.go)
#rootObject.updateSignal.connect(now.emit_now)
sound.setPositionCallback(rootObject.updateProgress)
# Update the user interface with the current date and time.
#now.now.connect(rootObject.updateMessage)
# Provide an initial message as a prompt.
#rootObject.updateMessage("Click to get the current date and time")
# Display the user interface and allow the user to interact with it.
view.setGeometry(0, 0, 1137, 798)
view.show()
rootObject.addSound(1, 2, "+", "NEW.mp3")
sound.play()
app.exec_()
示例12: len
# 需要导入模块: from PyQt4.QtDeclarative import QDeclarativeView [as 别名]
# 或者: from PyQt4.QtDeclarative.QDeclarativeView import setGeometry [as 别名]
gcard = "ati"
else:
rootObject.updateGraphicsdriverimg("img/hardware.png")
#global gcard
gcard = "empty"
# Set available drivers
if gcard == "nvidia":
rootObject.stable_driver(driver_version_stable.strip())
#if len(nvidia_driver_version_experimental) > 0:
#rootObject.experimental_driver(nvidia_driver_version_experimental.strip())
#else:
rootObject.hide_experimental_driver()
elif gcard == "ati":
rootObject.stable_driver(driver_version_stable.strip())
#if len(fglrx_driver_version_experimental) > 0:
#rootObject.experimental_driver(fglrx_driver_version_experimental.strip())
#else:
rootObject.hide_experimental_driver()
# Display the user interface and allow the user to interact with it.
view.setGeometry(100, 100, 500, 300)
view.setFixedSize(500, 300)
view.setWindowTitle(QCoreApplication.translate(None, 'ZevenOS Hardware Manager'))
screen = QDesktopWidget().screenGeometry()
size = view.geometry()
view.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
view.show()
app.exec_()