我是Kivy GUI框架的新手,我有几个与kvlang相关的问题:
1.如何将我的自定义窗口小部件类添加到kv文件中的root?(示例)PS:我在这里使用clear_widgets()然后我尝试添加我的自定义窗口小部件,但是在单击按钮后出现错误.
#:kivy 1.8
<HelloWorldForm@BoxLayout>:
orientation: "vertical"
Label:
text:"Hello world"
Button:
text: "Go back"
on_press: app.formGoBack()
<MainForm@BoxLayout>:
orientation: "vertical"
btnOpenForm: btnChangeForm
BoxLayout:
size_hint_y:None
height:"40dp"
Button:
id:btnChangeForm
text:"Go to hello world form"
on_press:
root.clear_widgets()
root.add_widget(HelloWorldForm)
Button:
id:btnExit
text:"Exit"
on_press: app.Exit()
MainForm:
Run Code Online (Sandbox Code Playgroud)
如何HelloWorldForm使用add_widget方法添加widget类
2.如何在python代码中使用add_widget和clear_widgets方法?(例如)
<MainForm@BoxLayout>:
orientation: "vertical"
btnOpenForm: btnChangeForm
BoxLayout:
size_hint_y:None
height:"40dp"
Button:
id:btnChangeForm
text:"Go to hello world form"
on_press: app.changeForm()
Run Code Online (Sandbox Code Playgroud)
#!/usr/bin/python3.4
import kivy
kivy.require('1.8.0')
from kivy.app import App …Run Code Online (Sandbox Code Playgroud) 我用pyqt5.But写了简单的hello world.当我启动它时,我得到错误:
QQuickView only supports loading of root objects that derive from QQuickItem.
If your example is using QML 2, (such as qmlscene) and the .qml file you
loaded has 'import QtQuick 1.0' or 'import Qt 4.7', this error will occur.
To load files with 'import QtQuick 1.0' or 'import Qt 4.7', use the
QDeclarativeView class in the Qt Quick 1 module.
Run Code Online (Sandbox Code Playgroud)
我试图解决它,但我想我不明白发生了什么.有人可以在更多细节中向我解释这个错误,我该如何解决?
#!/usr/bin/python3.4
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.Qt import *
from PyQt5.QtQuick import …Run Code Online (Sandbox Code Playgroud) Okey的家伙我以为在用gstreamer几天之后我就明白了,我写了一些管道,但是在逻辑上工作但是在保存流到文件时我很头疼.
gst-launch-1.0 rtspsrc location=rstp://ip/url ! decodebin ! textoverlay text="Work you damn thing " ! x264enc ! h264parse ! mp4mux ! filesink location=some_video.mp4
Run Code Online (Sandbox Code Playgroud)
哦,这是我的逻辑:
1. rtspsrc - has one pad and it's src it outputs x/rtps
2. decodebin - is a bin (bunch of elements) it has ghost pads and one of those
sink pads accept x/rtps then on source pad it generates raw video
4. x264enc - accepts raw video on sink pad and encodes it to a h264 raw …Run Code Online (Sandbox Code Playgroud) 关于gstreamer 1.0文档和移植指南的Okey我没有发现任何关于events.I试图在我的管道中设置一个eos信号,以便mp4mux可以像这样最终化流:
self.pipe.send_event(Gst.event_new_eos())
Run Code Online (Sandbox Code Playgroud)
但得到了错误:
AttributeError: 'gi.repository.Gst' object has no attribute 'event_new_eos'
Run Code Online (Sandbox Code Playgroud)
而且我认为我拼写错误或者出了什么问题我用Google搜索并在1.00中找到了一些示例而1.0中没有任何例子但问题是我没有找到任何关于send_event或Gst.event_new_eos()移植指南的内容.如果有人能告诉我我是什么,我将不胜感激在这里失踪?
关于gstreamer和tee元素我很好奇处理不同的分支,例如,如果我有这个管道:
gst-launch-1.0 -e videotestsrc ! tee name=spliter spliter. ! queue ! udpsink spliter. ! queue ! x264enc ! mp4mux ! filesink location=something.mp4
Run Code Online (Sandbox Code Playgroud)
如果出现类似的情况,我怎么能处理连接丢失或硬盘不够而没有管道故障的问题?