@@ -56,19 +56,19 @@ def init(self):
5656 self .btn_dislike = widget .PrimaryButton (
5757 self .commandbar , text = 'Nope' , bg = 'red' , command = self .cmd_dislike
5858 )
59- self .btn_bio = widget .PrimaryButton (
59+ self .btn_bio = widget .SecondaryButton (
6060 self .commandbar , text = 'Bio' , command = self .cmd_bio
6161 )
6262 self .btn_like = widget .PrimaryButton (
6363 self .commandbar , text = 'Yep' , bg = 'green' , command = self .cmd_like
6464 )
6565 self .title .pack (fill = 'x' , expand = True )
6666 self .window .pack (fill = 'both' , expand = True )
67- self .commandbar .pack (side = 'bottom' , fill = 'x ' , expand = True )
67+ self .commandbar .pack (side = 'bottom' , fill = 'both ' , expand = True )
6868
6969 self .btn_dislike .pack (side = 'left' )
70- self .btn_bio .pack (side = 'left ' )
71- self .btn_like .pack (side = 'left' )
70+ self .btn_like .pack (side = 'right ' )
71+ self .btn_bio .pack ()
7272
7373 self .cache = ImageCache (self .cachesize )
7474 self .cache .start ()
@@ -98,19 +98,32 @@ def init(self):
9898 self .config (height = height , width = width )
9999 self .pack_propagate (0 )
100100
101- def __make_item (self , name , value ):
102- item = widget .SecondaryFrame (self )
103- name = widget .SecondaryLabel (item , text = name )
104- value = widget .SecondaryLabel (item , text = value )
105- name .pack (side = 'left' )
106- value .pack (side = 'left' )
101+ def __build_info (self , info : dict ):
102+ item = widget .PrimaryFrame (self )
103+ info = [
104+ f"Age: { info ['age' ]} " ,
105+ info ['gender' ].capitalize (),
106+ f'{ "She" if info ["gender" ].startswith ("f" ) else "He" } is { info ["location" ]} .'
107+ ]
108+ for val in info :
109+ name = widget .PrimaryLabel (item , text = val , font = ('sys' , 15 ), fg = 'gray' )
110+ name .pack (fill = 'both' )
107111 return item
108112
113+ def __build_hobbies (self , hobbies ):
114+ frame = widget .PrimaryFrame (self )
115+ title = widget .PrimaryLabel (frame , text = 'Hobbies' , font = ('sys' , 15 ), justify = 'left' )
116+ title .pack (fill = 'both' )
117+ for hobby in hobbies :
118+ val = widget .SecondaryLabel (frame , text = hobby )
119+ val .pack (fill = 'both' )
120+ return frame
121+
109122 def load (self , data : dict ):
110- # print (data)
111- for name , val in data . items ():
112- item = self . __make_item ( name , val )
113- item .pack (expand = True , fill = 'x ' )
123+ info = self . __build_info (data [ 'info' ] )
124+ hobbies = self . __build_hobbies ( data [ 'hobbies' ])
125+ info . pack ( expand = True , fill = 'both' )
126+ hobbies .pack (expand = True , fill = 'both ' )
114127
115128
116129class Splash (widget .PrimaryFrame ):
0 commit comments