def test_visibility(self): card_widget = CardWidget(Card(Suit.SPADES, CardValue.ACE), aspect_ratio=0.5) self.assertTrue(card_widget.visible) card_front_filename = card_widget.children[0].source card_widget.visible = False self.assertFalse(card_widget.visible) card_back_filename = card_widget.children[0].source self.assertNotEqual(card_front_filename, card_back_filename) card_widget.visible = True self.assertTrue(card_widget.visible) self.assertEqual(card_front_filename, card_widget.children[0].source)
if self._closed: self._trump_card.rotation = 10 self._trump_card.center = self.to_parent( local_talon_pos[0] + self._talon_size[0] / 2, local_talon_pos[1] + self._talon_size[1] / 2, True) else: self._trump_card.rotation = 90 self._trump_card.pos = self.to_parent((self.width - height) / 2.0, (self.height - width) / 2.0, True) if __name__ == "__main__": RATIO = 10 talon_widget = TalonWidget(RATIO) talon_widget.pos = 50, 50 talon_widget.size = 1000, 1000 talon_widget.size_hint = None, None trump_card = CardWidget(Card(Suit.SPADES, CardValue.ACE), aspect_ratio=RATIO) talon_widget.set_trump_card(trump_card) _card = CardWidget(Card(Suit.SPADES, CardValue.ACE), aspect_ratio=RATIO) _card.visible = False talon_widget.push_card(_card) runTouchApp(talon_widget) # noinspection PyStringFormat print("(%.1f, (%d, %d), [%d, %d], (%.1f, %.1f), (%.1f, %.1f))" % ( RATIO, *talon_widget.size, *_card.size, *_card.pos, *trump_card.pos))