@@ -24,15 +24,21 @@ class Front(widget.PrimaryFrame):
2424
2525 def __next (self ):
2626 data : dict = self .cache .next ()
27- image = process_image (data .pop ('image' ), 400 , 280 )
27+ image = process_image (
28+ data .pop ('image' ),
29+ self .window .winfo_width (),
30+ self .window .winfo_height ()
31+ )
2832 name = data .pop ('name' )
2933 self .__load (name , image , data )
3034
3135 def __load (self , name , image , data ):
3236 self .title .config (text = name )
33- self .bio .data .load (data )
34- self ._last = self .image
3537 self .image = View (image , 'image' )
38+ self .bio = View (Bio (self .window ), 'widget' )
39+
40+ self ._last = self .image
41+ self .bio .data .load (data )
3642 self .update ()
3743
3844 def __change_image (self , direction : Direction ):
@@ -44,7 +50,7 @@ def init(self):
4450 self .window = Window (self )
4551 self .commandbar = widget .SecondaryFrame (self )
4652
47- self .bio = View ( Bio ( self . window ), 'widget' )
53+ self .bio = None
4854 self .image = None
4955
5056 self .btn_dislike = widget .PrimaryButton (
@@ -56,21 +62,21 @@ def init(self):
5662 self .btn_like = widget .PrimaryButton (
5763 self .commandbar , text = 'Yep' , bg = 'green' , command = self .cmd_like
5864 )
59- self .title .pack (fill = 'x' )
60- self .window .pack (fill = 'both' )
61- self .commandbar .pack (side = 'bottom' , fill = 'x' )
65+ self .title .pack (fill = 'x' , expand = True )
66+ self .window .pack (fill = 'both' , expand = True )
67+ self .commandbar .pack (side = 'bottom' , fill = 'x' , expand = True )
6268
63- self .btn_bio .pack ()
6469 self .btn_dislike .pack (side = 'left' )
65- self .btn_like .pack (side = 'right' )
70+ self .btn_bio .pack (side = 'left' )
71+ self .btn_like .pack (side = 'left' )
6672
6773 self .cache = ImageCache (self .cachesize )
6874
6975 def cmd_dislike (self ):
70- self .__change_image ('right ' )
76+ self .__change_image ('left ' )
7177
7278 def cmd_like (self ):
73- self .__change_image ('left ' )
79+ self .__change_image ('right ' )
7480
7581 def cmd_bio (self ):
7682 if self .window .current != self .bio :
@@ -93,11 +99,11 @@ def cache(self, imagecache: ImageCache):
9399
94100class Bio (widget .PrimaryFrame ):
95101
96- # def init(self):
97- # width = self.master.winfo_width()
98- # height = self.master.winfo_height()
99- # self.config(height=height, width=width)
100- # # self.pack_propagate(0)
102+ def init (self ):
103+ width = self .master .winfo_width ()
104+ height = self .master .winfo_height ()
105+ self .config (height = height , width = width )
106+ self .pack_propagate (0 )
101107
102108 def __make_item (self , name , value ):
103109 item = widget .SecondaryFrame (self )
0 commit comments