Skip to content

Commit a216015

Browse files
committed
Add basic tkinter app and run it on GitHub Actions CI.
The app closes itself after 5 seconds.
1 parent 5745452 commit a216015

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

‎.github/workflows/tk.yml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Test Python Tk
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
tests-poetry:
7+
strategy:
8+
matrix:
9+
os: [ubuntu-latest, macos-latest, windows-latest]
10+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
11+
fail-fast: false
12+
name: Py ${{ matrix.python-version }} - ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python ${{ matrix.python-version }}
17+
uses: actions/setup-python@v3
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Prepare Ubuntu xvfb
21+
if: runner.os == 'Linux'
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y libxkbcommon-x11-0 xvfb
25+
- name: Run tk script (closes itself after 5 seconds) - Ubuntu
26+
if: runner.os == 'Linux'
27+
run: xvfb-run python tk_min.py
28+
- name: Run tk script (closes itself after 5 seconds)
29+
if: runner.os != 'Linux'
30+
run: python tk_min.py

‎tk_min.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Simple Hello World! Tkinter GUI app that closes itself after 5 seconds.
5+
"""
6+
import tkinter as tk
7+
8+
9+
root = tk.Tk()
10+
11+
label = tk.Label(root, text="Hello World!")
12+
label.pack(padx=20, pady=20)
13+
14+
# Close the Window after 5 seconds
15+
root.after(5000, root.destroy)
16+
17+
root.mainloop()

0 commit comments

Comments
 (0)