• pavlinb

    Another good example:

    # coding: utf-8
    
    # https://github.com/jsbain/objc_hacks/blob/master/live_camera_view.py
    
    # https://forum.omz-software.com/topic/2062/video-preview-inside-ui-view-beta
    
    from objc_util import *
    import ui
    
    class LiveCameraView(ui.View):
        def __init__(self,device=0, *args, **kwargs):
            ui.View.__init__(self,*args,**kwargs)
            self._session=ObjCClass('AVCaptureSession').alloc().init()
            self._session.setSessionPreset_('AVCaptureSessionPresetHigh');
            inputDevices=ObjCClass('AVCaptureDevice').devices()
            self._inputDevice=inputDevices[device]
            
            deviceInput=ObjCClass('AVCaptureDeviceInput').deviceInputWithDevice_error_(self._inputDevice, None);
            if self._session.canAddInput_(deviceInput):
                self._session.addInput_(deviceInput)
            self._previewLayer=ObjCClass('AVCaptureVideoPreviewLayer').alloc().initWithSession_(self._session)
            self._previewLayer.setVideoGravity_(
            'AVLayerVideoGravityResizeAspectFill')
            rootLayer=ObjCInstance(self).layer()
            rootLayer.setMasksToBounds_(True)
            self._previewLayer.setFrame_(
            CGRect(CGPoint(-70, 0), CGSize(self.height,self.height)))
            rootLayer.insertSublayer_atIndex_(self._previewLayer,0)
            self._session.startRunning()
        def will_close(self):
            self._session.stopRunning()
        def layout(self):
            if not self._session.isRunning():
                self._session.startRunning()
                
    rootview=LiveCameraView(frame=(0,0,576,576))
    rootview.present('sheet') 
    

    posted in Pythonista read more
  • pavlinb

    I have tried yor code, but I received

    for c in self.grid.living_cells():
    AttributeError: 'MyScene' object has no attribute 'grid' 
    

    posted in Pythonista read more
  • pavlinb

    @cvp You are right maybe. Obviously I need real application for such purposes, not today widget.

    posted in Pythonista read more
  • pavlinb

    @cvp I’m not 100% sure, because i have tried a lot of notifiers, but if I remember well, only time delay notifier works when main app ( Pythonista) is closed.

    posted in Pythonista read more
  • pavlinb

    I mean It would be great if Pythonista today widget can send push notifications.
    If you look on my screenshot f.e., in case there is a change of number of courts.

    posted in Pythonista read more
  • pavlinb

    And if it’s possible to send push notification about changes, it would be great.

    posted in Pythonista read more
  • pavlinb

    Here is a screenshot of my widget - now it works almost perfect.

    I have up-to-date information about free tennis courts.

    link

    posted in Pythonista read more
  • pavlinb

    Thank you for the answer.

    Please, don't remove widgets.

    I know they are limited and will modify my source in order to work.

    Thanks.

    posted in Pythonista read more
  • pavlinb

    Hi,
    Is there a way to debug a today widget?

    In Pythonista app widget works as I want, but as a today widget sometimes works good, sometimes bad.

    posted in Pythonista read more
  • pavlinb

    I have Pythonista v3.2 , iPhone v13.3.1,
    re works perfect.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!