Python Forum
Placing image button on top of background image
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Placing image button on top of background image
#2
So...I played around today and finally got this figured out...
Step 1 down...Lotsa steps to go...
Home = """
<EzHomeScreen>:
    canvas.before:
        Rectangle:
            pos: self.pos
            size: self.size
            source: 'Images\main.png'                
    FloatLayout:
        Button:
            background_color: 0, 0 ,0, 0
            size_hint: .32, .046         
            on_press: root.leave() 
            pos_hint: {'center_x': 0.18, 'center_y': 0.165}   
            Image:
                source: "Images\leave.png"
                center_x: self.parent.center_x
                center_y: self.parent.center_y
        Button:
            background_color: 0, 0 ,0, 0
            size_hint: .32, .046         
            on_press: root.print() 
            pos_hint: {'center_x': 0.50, 'center_y': 0.165}   
            Image:
                source: "Images\print.png"
                center_x: self.parent.center_x
                center_y: self.parent.center_y
        Button:
            background_color: 0, 0 ,0, 0
            size_hint: .32, .046         
            on_press: root.launch() 
            pos_hint: {'center_x': 0.82, 'center_y': 0.165}   
            Image:
                source: "Images\launch.png"
                center_x: self.parent.center_x
                center_y: self.parent.center_y
"""

Builder.load_string(Home)

class EzHomeScreen(Screen):
    def leave(self):
        print('leave pressed')  
    def leave(self):
        print('print pressed') 
    def leave(self):
        print('launch pressed')
pass


sm = ScreenManager(transition=FadeTransition())
sm.add_widget(EzHomeScreen(name='EzHome'))


class ToTSlider(App):
    def build(self):
        return sm
Reply


Messages In This Thread
RE: Placing image button on top of background image - by Sintek - Mar-02-2025, 05:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  image does not show with pillow Mohamad_afeff_nasser 5 1,639 Apr-13-2025, 07:53 PM
Last Post: snippsat
  Problem When using canny edge detection,black image returned rickyw2777 1 539 Feb-17-2025, 03:22 AM
Last Post: rickyw2777
  Why it gives me a black image and libpng warning: iCCP rickyw2777 1 553 Feb-16-2025, 08:26 PM
Last Post: rickyw2777
  QR code creation with image Raja31 1 1,127 Jan-15-2025, 11:17 AM
Last Post: Larz60+
Photo image generation with text style Belialhun 0 726 Oct-08-2024, 01:53 PM
Last Post: Belialhun
  Product Image Download Help Required pythonustasi 5 1,498 Jul-21-2024, 08:12 PM
Last Post: snippsat
  tkinter photo image problem jacksfrustration 5 3,968 Jun-27-2024, 12:06 AM
Last Post: AdamHensley
Photo image error pyc0de 2 2,037 Mar-23-2024, 06:20 PM
Last Post: pyc0de
  Using OpenCV and image path is invalid AudunNilsen 5 2,148 Mar-18-2024, 05:28 PM
Last Post: snippsat
  Count image's colors very fast flash77 18 8,392 Mar-05-2024, 06:12 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020