简体   繁体   中英

Making project in kivy and python

How to create a button to save image. Any other button to set wallpaper.

I am new in kivy not in Python.

How to create button using image in Kivy

import kivy           

kivy.require("1.9.1")  
from kivy.app import App          
from kivy.uix.button import Button
kivy.require('1.9.0')            
from kivy.config import Config  
      
Config.set('graphics', 'resizable', True)           

class ButtonApp(App):  
         
    def build(self):  
   
        btn = Button(text ="Push Me !", 
                     color =(1, 0, .65, 1), 
                     background_normal = 'normal.png', 
                     background_down ='down.png', 
                     size_hint = (.3, .3), 
                     pos_hint = {"x":0.35, "y":0.3} 
                   )  
      
        return btn  
             

root = ButtonApp()          

root.run()

Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM