Reputation: 429
I have been trying to create a simple tic-tac-toe app in Kivy. I started by laying out the UI, and found that the top section is hidden under the Windows title bar. I have tried to search around for an answer in the Kivy docs, on StackOverflow, etc. but had no luck.
Here's a screenshot for reference: Titlebar covering up part of Kivy app
.kv file
#:kivy 1.0.9
BoxLayout:
orientation: "vertical"
ActionBar:
ActionView:
use_separator: True
ActionPrevious:
title: 'Action Bar'
with_previous: False
ActionOverflow:
ActionButton:
text: 'Btn0'
icon: 'atlas://data/images/defaulttheme/audio-volume-high'
ActionButton:
text: 'Btn1'
ActionGroup:
text: 'Group1'
ActionButton:
text: 'Btn2'
TicTacToeGrid:
<GridEntry>:
font_size: self.height
background_color: 0, 0, 0, 0
<TicTacToeGrid>:
cols: 3
canvas.after:
Color:
rgba: 0.149, 0.102, 0.051, 1.0
Line:
points: self.width/3, self.center_y - (self.height * 0.45), self.width/3, self.center_y + (self.height * 0.45)
width: 2
Line:
points: self.width*2/3, self.center_y - (self.height * 0.45), self.width*2/3, self.center_y + (self.height * 0.45)
width: 2
Line:
points: self.center_x - (self.width * 0.45), self.height/3, self.center_x + (self.width * 0.45), self.height/3
width: 2
Line:
points: self.center_x - (self.width * 0.45), self.height*2/3, self.center_x + (self.width * 0.45), self.height*2/3
width: 2
.py file
from kivy.uix.gridlayout import GridLayout
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.properties import ListProperty
class GridEntry(Button):
coords = ListProperty([0, 0])
class TicTacToeGrid(GridLayout):
'''Kivy widget for the tic-tac-toe board'''
def __init__(self, *args, **kwargs):
super(TicTacToeGrid, self).__init__(*args, **kwargs)
for row in range(3):
for column in range(3):
grid_entry = GridEntry(
coords=(row, column))
grid_entry.bind(on_release=self.button_pressed)
self.add_widget(grid_entry)
def button_pressed(self, button):
'''Print output just to see what's going on'''
print('{} button clicked!'.format(button.coords))
class TicTacToeApp(App):
'''Tic-tac-toe app using Kivy'''
def build(self):
Window.clearcolor = (0.688, 0.664, 0.640, 1)
return self.root
if __name__ == "__main__":
TicTacToeApp().run()
Help would be greatly appreciated.
Upvotes: 2
Views: 408
Reputation: 11
I had the exact same problem recently on my dell XPS 15. Updating the drivers for the integrated graphics processor through device manager resolved it on my set up, have you tried that?
Upvotes: 1