Created
November 17, 2016 03:25
-
-
Save spiridonovpolytechnic/18483d02bc19a59136c7361fe3248088 to your computer and use it in GitHub Desktop.
Raspberry Pi kivy dual display code structure example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process, Manager, Event | |
def display_process(dict_global, is_master, exit_event): | |
import os | |
if is_master: | |
os.environ["KIVY_BCM_DISPMANX_ID"] = "4" | |
else: | |
os.environ["KIVY_BCM_DISPMANX_ID"] = "5" | |
# kivy module imports go here | |
# ButtonDIPO, LabelD, and MyApp class definitions | |
app = MyApp() # create an app and run it | |
app.run() | |
if __name__ == '__main__': | |
m = Manager() | |
dict_main = m.dict() | |
ev = Event() | |
dict_main['counter'] = 0 | |
proc_master = Process(target=display_process, args=(dict_main,True, ev)) | |
proc_slave = Process(target=display_process, args=(dict_main, False, ev)) | |
proc_master.start() | |
proc_slave.start() | |
proc_master.join() | |
proc_slave.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment