파이썬[Python]: kivy - QueryDict클래스

이미지
kivy.utils 모듈 - QueryDict 클래스(class) /// 설명 .(dot)으로 딕셔너리를 생성(혹은 query)할 수 있습니다. 참고: utils to wealkproxy 모듈 목록 ※ 형식 QueryDict() reference https://kivy.org/doc/stable/api-kivy.utils.html /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 import  kivy   kivy.require( '2.1.0' )   from  kivy.app  import  App from  kivy.core.window  import  Window from  kivy.uix.boxlayout  import  BoxLayout from  kivy.uix.button  import  Button from  kivy.uix.label  import  Label from  kivy.utils  import  QueryDict   Window.clearcolor  =  ( 1 ,  1 ,  1 ,  1 ) Window.size  =  ( 563 ,  1001 ) Window.top, Window.left  =   30 ,  2900     class  FantasticApp(App):      def  _bt_release( self , bt_inst):         test_dict  =  QueryDict()         test_dict.a  =   1          self .lb.text  =  f "key: a, value: {test_dict.a}"        def  build( self ):         bl  =  BoxLayout(orientation = "vertical" )            self

파이썬[Python]: 내장함수 - __setattr__ 메서드

파이썬(Phthon): 내장함수 - __setattr__ 메서드(method) /// 설명 클래스의 속성(attribute)에 값을 할당하고자 할 경우 호출 됩니다. ※ 형식 object.__setattr__(self, name, value) reference https://docs.python.org/3/reference/datamodel.html#object.__setattr__ /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 class  A:      def  __init__( self , a):          self .a  =  a        def  __setattr__( self , attr, value):         value  =  f 'attribute: {attr}, value: {value}'          super ().__setattr__(attr, value)          # object.__setattr__(self, attr, value)     a  =  A( 'String' ) print (a.a)   # attribute: a, value: String a.a  =   'a' print (a.a)   # attribute: a, value: a   # create new attribute a.b  =   'b' print (a.b)   # attribute: b, value: b   # create new attribute setattr(a,  'c' ,  'c' ) print (a.c)   # attribute: b, value: b   # create new attribute a.__dict__[ 'd' ]  =   'd' print (a.d)   # d print (a._

파이썬[Python]: datetime - utcoffset 메서드

datetime 모듈 - datetime 클래스 - utcoffset 메서드(method) /// 설명 UTC 시간과 현지시간(타임존)의 차이를 나타냅니다. ※ 형식 datetime.utcoffset() reference https://docs.python.org/3/library/datetime.html#module-datetime /// 예제 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 import  datetime   year  =  datetime.datetime.now().year month  =  datetime.datetime.now().month day  =  datetime.datetime.now().day hour  =  datetime.datetime.now().hour minute  =  datetime.datetime.now().minute second  =  datetime.datetime.now().second microsecond  =  datetime.datetime.now().microsecond   test_dt  =  datetime.datetime(year = year, month = month, day = day, hour = hour, minute = minute,                             second = second, microsecond = microsecond, tzinfo = None , fold = 0 )   print (test_dt.utcoffset())   # None   test_timezone  =  datetime.timezone(datetime.timedelta(hours = 9 ),  'KST' ) test_dt  =  datetime.datetime(year = year, month = month, day = day, hour = hour, minute = minute,   

파이썬[Python]: kivy, OpenGL ES - 육면체 회전

이미지
kivy.graphics 모듈 - OpenGL ES /// 설명 육면체(회전) 참고: OpenGL ES 모듈 목록 reference https://www.youtube.com/playlist?list=PL1P11yPQAo7qEnF_EysHOBUfF0AzUz3jh /// 예제 main.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 import  kivy   kivy.require( '2.0.0' )   from  kivy.app  import  App from  kivy.core.window  import  Window from  kivy.clock  import  Clock from  kivy.resources  import  resource_find from  kivy.graphics  import   * from  kivy.graphics.opengl  import   * from  kivy.graphics.transformation  import  Matrix from  kivy.uix.widget  import  Widget   Window.clearcolor  =  ( 1 ,  1 ,  1 ,  1 ) Window.size  =  ( 563 ,  1001 ) Window.top, Window.left  =   30 ,  2900   #           positions          colors vertices  =  [ - 0. 5 ,  - 0. 5 ,   0. 5 ,   1. 0 ,  0. 0 ,  0. 0 ,               0. 5 ,  - 0. 5 ,   0. 5 ,  

파이썬[Python]: kivy, OpenGL ES - 육면체 그리기

이미지
kivy.graphics 모듈 - OpenGL ES /// 설명 육면체를 그립니다. 참고: OpenGL ES 모듈 목록 reference https://www.youtube.com/playlist?list=PL1P11yPQAo7qEnF_EysHOBUfF0AzUz3jh /// 예제 main.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 import  kivy   kivy.require( '2.0.0' )   from  kivy.app  import  App from  kivy.core.window  import  Window from  kivy.resources  import  resource_find from  kivy.graphics  import   * from  kivy.graphics.opengl  import   * from  kivy.graphics.transformation  import  Matrix from  kivy.uix.widget  import  Widget   Window.clearcolor  =  ( 1 ,  1 ,  1 ,  1 ) Window.size  =  ( 563 ,  1001 ) Window.top, Window.left  =   30 ,  2900   #           positions          colors vertices  =  [ - 0. 5 ,  - 0. 5 ,   0. 5 ,   1. 0 ,  0. 0 ,  0. 0 ,               0. 5 ,  - 0. 5 ,   0. 5 ,   0. 0 ,  1. 0 ,  0. 0 ,