-
-
Notifications
You must be signed in to change notification settings - Fork 216
/
Copy pathtest_idtocommand.py
38 lines (30 loc) · 898 Bytes
/
test_idtocommand.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# encoding: utf-8
import os
import sys
import unittest
import tkinter as tk
import tkinter.ttk as ttk
import fixpath
import pygubu
import support
class TestIdtocommand(unittest.TestCase):
def setUp(self):
support.root_deiconify()
xmldata = "test_idtocommand.ui"
self.builder = builder = pygubu.Builder()
builder.add_from_file(xmldata)
self.widget = builder.get_object("mainwindow")
self.button = builder.get_object("button1")
def tearDown(self):
support.root_withdraw()
def test_idtocommand(self):
success = []
class AnObject:
def on_button_clicked(self, widgetid):
success.append(1)
cbobj = AnObject()
self.builder.connect_callbacks(cbobj)
self.button.invoke()
self.widget.update()
self.assertTrue(success)
self.widget.destroy()