Created
          June 4, 2015 21:28 
        
      - 
      
- 
        Save kived/335207d56c8356d3ba89 to your computer and use it in GitHub Desktop. 
    Kivy: texture_size demo
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import kivy | |
| kivy.require('1.8.1') | |
| from kivy.app import App | |
| from kivy.lang import Builder | |
| root = Builder.load_string(''' | |
| <TestButton@Button>: | |
| size_hint: None, None | |
| width: self.texture_size[0] + dp(16) | |
| height: self.texture_size[1] + dp(12) | |
| FloatLayout: | |
| TestButton: | |
| pos: 100, 100 | |
| text: 'hello' | |
| TestButton: | |
| pos: 300, 200 | |
| text: 'longer button label' | |
| ''') | |
| class TestApp(App): | |
| def build(self): | |
| return root | |
| if __name__ == '__main__': | |
| TestApp().run() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment