Closed Antonio0307 closed 2 years ago
from remi.gui import from widgets.toolbox_opencv import from remi import start, App
list = ["u.mp4"] class untitled(App): def init(self, *args, **kwargs):
if not 'editing_mode' in kwargs.keys():
super(untitled, self).__init__(*args, static_file_path={'my_res':'./res/'})
def idle(self):
#idle function called every update cycle
pass
def main(self):
return untitled.construct_ui(self)
@staticmethod
def construct_ui(self):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
container0 = Container()
container0.attr_class = "Container"
container0.attr_editor_newclass = False
container0.css_height = "435.0px"
container0.css_left = "165.0px"
container0.css_position = "absolute"
container0.css_top = "30.0px"
container0.css_width = "390.0px"
container0.variable_name = "container0"
opencvvideo0 = OpencvVideo()
opencvvideo0.attr_class = "OpencvVideo"
opencvvideo0.attr_editor_newclass = False
opencvvideo0.css_height = "180.0px"
opencvvideo0.css_left = "45.0px"
opencvvideo0.css_position = "absolute"
opencvvideo0.css_top = "15.0px"
opencvvideo0.css_width = "300.0px"
opencvvideo0.framerate = 10
opencvvideo0.variable_name = "opencvvideo0"
opencvvideo0.video_source = list[-1]
container0.append(opencvvideo0,'opencvvideo0')
vbox0 = VBox()
vbox0.attr_class = "VBox"
vbox0.attr_editor_newclass = False
vbox0.css_align_items = "center"
vbox0.css_display = "flex"
vbox0.css_flex_direction = "column"
vbox0.css_height = "195.0px"
vbox0.css_justify_content = "space-around"
vbox0.css_left = "45.0px"
vbox0.css_position = "absolute"
vbox0.css_top = "210.0px"
vbox0.css_width = "150.0px"
vbox0.variable_name = "vbox0"
button0 = Button()
button0.attr_class = "Button"
button0.attr_editor_newclass = False
button0.css_height = "30px"
button0.css_order = "-1"
button0.css_position = "static"
button0.css_top = "20px"
button0.css_width = "100px"
button0.text = "button 0"
button0.variable_name = "button0"
vbox0.append(button0,'button0')
button1 = Button()
button1.attr_class = "Button"
button1.attr_editor_newclass = False
button1.css_height = "30px"
button1.css_order = "-1"
button1.css_position = "static"
button1.css_top = "20px"
button1.css_width = "100px"
button1.text = "button 1"
button1.variable_name = "button1"
vbox0.append(button1,'button1')
button2 = Button()
button2.attr_class = "Button"
button2.attr_editor_newclass = False
button2.css_height = "30px"
button2.css_order = "-1"
button2.css_position = "static"
button2.css_top = "20px"
button2.css_width = "100px"
button2.text = "button 2"
button2.variable_name = "button2"
vbox0.append(button2,'button2')
container0.append(vbox0,'vbox0')
container0.children['vbox0'].children['button0'].onclick.do(self.onclick_button0)
container0.children['vbox0'].children['button1'].onclick.do(self.onclick_button1)
container0.children['vbox0'].children['button2'].onclick.do(self.onclick_button2)
self.container0 = container0
return self.container0
def onclick_button0(self, emitter):
list.append("u.mp4")
print(list)
pass
def onclick_button1(self, emitter):
list.append("u1.mp4")
pass
def onclick_button2(self, emitter):
pass
configuration = {'config_project_name': 'untitled', 'config_address': '0.0.0.0', 'config_port': 8081, 'config_multiple_instance': True, 'config_enable_file_cache': True, 'config_start_browser': True, 'config_resourcepath': './res/'}
if name == "main":
start(untitled, address=configuration['config_address'], port=configuration['config_port'],
multiple_instance=configuration['config_multiple_instance'],
enable_file_cache=configuration['config_enable_file_cache'],
start_browser=configuration['config_start_browser'])
Hello @Antonio0307 ,
Can you please better explain your problem? Maybe with a drawing if could help
Hello @Antonio0307 ,
Can you please better explain your problem? Maybe with a drawing if could help
I have a screen in my browser that plays videos,there are three video sources,I need to select one of the video sources to play. It has to be a button1 button2 button3 ............It's like changing the TV channel...u know..
I don't know what to do.
picture,thank you !
------------------ 原始邮件 ------------------ 发件人: "dddomodossola/remi" @.>; 发送时间: 2021年10月11日(星期一) 晚上10:06 @.>; 抄送: "枫枫 @.**@.>; 主题: Re: [dddomodossola/remi] ask for help (#467)
Hello @Antonio0307 ,
Can you please better explain your problem? Maybe with a drawing if could help
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
Hello @Antonio0307 , here is the example. It is really easy, just change the video_source attribute of the opencv video widget.
from remi.gui import *
from widgets.toolbox_opencv import *
from remi import start, App
list = ["./0.mp4", "./1.mp4", "./2.mp4"]
class untitled(App):
def init(self, *args, **kwargs):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
if not 'editing_mode' in kwargs.keys():
super(untitled, self).init(*args, static_file_path={'my_res':'./res/'})
def idle(self):
#idle function called every update cycle
pass
def main(self):
return untitled.construct_ui(self)
@staticmethod
def construct_ui(self):
#DON'T MAKE CHANGES HERE, THIS METHOD GETS OVERWRITTEN WHEN SAVING IN THE EDITOR
container0 = Container()
container0.attr_class = "Container"
container0.attr_editor_newclass = False
container0.css_height = "435.0px"
container0.css_left = "165.0px"
container0.css_position = "absolute"
container0.css_top = "30.0px"
container0.css_width = "390.0px"
container0.variable_name = "container0"
opencvvideo0 = OpencvVideo()
opencvvideo0.attr_class = "OpencvVideo"
opencvvideo0.attr_editor_newclass = False
opencvvideo0.css_height = "180.0px"
opencvvideo0.css_left = "45.0px"
opencvvideo0.css_position = "absolute"
opencvvideo0.css_top = "15.0px"
opencvvideo0.css_width = "300.0px"
opencvvideo0.framerate = 10
opencvvideo0.variable_name = "opencvvideo0"
opencvvideo0.video_source = list[-1]
container0.append(opencvvideo0,'opencvvideo0')
vbox0 = VBox()
vbox0.attr_class = "VBox"
vbox0.attr_editor_newclass = False
vbox0.css_align_items = "center"
vbox0.css_display = "flex"
vbox0.css_flex_direction = "column"
vbox0.css_height = "195.0px"
vbox0.css_justify_content = "space-around"
vbox0.css_left = "45.0px"
vbox0.css_position = "absolute"
vbox0.css_top = "210.0px"
vbox0.css_width = "150.0px"
vbox0.variable_name = "vbox0"
button0 = Button()
button0.attr_class = "Button"
button0.attr_editor_newclass = False
button0.css_height = "30px"
button0.css_order = "-1"
button0.css_position = "static"
button0.css_top = "20px"
button0.css_width = "100px"
button0.text = "button 0"
button0.variable_name = "button0"
vbox0.append(button0,'button0')
button1 = Button()
button1.attr_class = "Button"
button1.attr_editor_newclass = False
button1.css_height = "30px"
button1.css_order = "-1"
button1.css_position = "static"
button1.css_top = "20px"
button1.css_width = "100px"
button1.text = "button 1"
button1.variable_name = "button1"
vbox0.append(button1,'button1')
button2 = Button()
button2.attr_class = "Button"
button2.attr_editor_newclass = False
button2.css_height = "30px"
button2.css_order = "-1"
button2.css_position = "static"
button2.css_top = "20px"
button2.css_width = "100px"
button2.text = "button 2"
button2.variable_name = "button2"
vbox0.append(button2,'button2')
container0.append(vbox0,'vbox0')
container0.children['vbox0'].children['button0'].onclick.do(self.onclick_button0)
container0.children['vbox0'].children['button1'].onclick.do(self.onclick_button1)
container0.children['vbox0'].children['button2'].onclick.do(self.onclick_button2)
self.container0 = container0
return self.container0
def onclick_button0(self, emitter):
self.container0.children['opencvvideo0'].video_source = list[0]
def onclick_button1(self, emitter):
self.container0.children['opencvvideo0'].video_source = list[1]
def onclick_button2(self, emitter):
self.container0.children['opencvvideo0'].video_source = list[2]
#Configuration
configuration = {'config_project_name': 'untitled', 'config_address': '0.0.0.0', 'config_port': 0, 'config_multiple_instance': True, 'config_enable_file_cache': True, 'config_start_browser': True, 'config_resourcepath': './res/'}
if __name__ == "__main__":
# start(MyApp,address='127.0.0.1', port=8081, multiple_instance=False,enable_file_cache=True, update_interval=0.1, start_browser=True)
start(untitled, address=configuration['config_address'], port=configuration['config_port'], multiple_instance=configuration['config_multiple_instance'], enable_file_cache=configuration['config_enable_file_cache'], start_browser=configuration['config_start_browser'])
self.container0.children['opencvvideo0'].video_source..............I can't believe I forgot that......... How stupid of me.........................thank you!
No problem, you are welcome ;-)
Again,you see a screenshot, red circle ,I'd like to adjust the size,size parameter,where is it in the editor? ------------------ 原始邮件 ------------------ 发件人: "dddomodossola/remi" @.>; 发送时间: 2021年10月14日(星期四) 下午2:10 @.>; 抄送: "枫枫 @.**@.>; 主题: Re: [dddomodossola/remi] ask for help (#467)
No problem, you are welcome ;-)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
@Antonio0307 I can't see the screenshot. Have you forgot to attach it?
Again~~~
Again,you see a screenshot, red circle ,I'd like to adjust the size,size parameter,where is it in the editor?
------------------ 原始邮件 ------------------
发件人: "dddomodossola/remi" @.>;
发送时间: 2021年10月14日(星期四) 下午2:10
@.>;
抄送: "枫枫 @.**@.>;
主题: Re: [dddomodossola/remi] ask for help (#467)
No problem, you are welcome ;-)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
I'm sure I already sent the email,and I sent it again。
@Antonio0307 I have not seen any email yet. I suggest to attach the screenshot here, drag and drop the image
@Antonio0307 I have not seen any email yet. I suggest to attach the screenshot here, drag and drop the image
Hello @Antonio0307 you cannot resize it by editor. The tabbox widget divides the size of tabs internally. You could eventually force the size by code, or use a different widget.
Hello @Antonio0307 you cannot resize it by editor. The tabbox widget divides the size of tabs internally. You could eventually force the size by code, or use a different widget.
How to get? How do I write it in code? Can you give me a simple example? When you are free.thank you!
Hello @Antonio0307, here is an example for you. In this example, the first tab gets resized.
import remi.gui as gui
from remi import start, App
class MyApp(App):
def __init__(self, *args):
super(MyApp, self).__init__(*args)
def main(self):
b1 = gui.Button('Show second tab', width=200, height=30)
tb = gui.TabBox(width='80%')
tb.append(b1, 'First')
b2 = gui.Button('Show third tab', width=200, height=30)
tb.add_tab(b2, 'Second', None)
b3 = gui.Button('Show first tab', width=200, height=30)
tb.add_tab(b3, 'Third', None)
#RESIZING first tab. Resizing must be done after populating all the tabs,
# otherwise it gets automatically resized after each new append
tb.container_tab_titles.children['First'].css_width = '200px'
b1.onclick.do(self.on_bt1_pressed, tb, b2)
b2.onclick.do(self.on_bt2_pressed, tb, 'Third')
b3.onclick.do(self.on_bt3_pressed, tb, 0)
return tb
def on_bt1_pressed(self, widget, tabbox, refWidgetTab):
tabbox.select_by_widget(refWidgetTab)
def on_bt2_pressed(self, widget, tabbox, refWidgetTabName):
tabbox.select_by_name(refWidgetTabName)
def on_bt3_pressed(self, widget, tabbox, tabIndex):
tabbox.select_by_index(tabIndex)
if __name__ == "__main__":
start(MyApp, title="Tab Demo", standalone=False)
I hope this can help you.
I have two rtmp"a and b ",there is a screen in the browser,I want two buttons source of switch, how make?