Skip to content

Commit

Permalink
Add basic tkinter app and run it on GitHub Actions CI.
Browse files Browse the repository at this point in the history
The app closes itself after 5 seconds.
  • Loading branch information
carlosperate committed May 6, 2022
1 parent 5745452 commit a216015
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/tk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test Python Tk

on: [push, pull_request]

jobs:
tests-poetry:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
fail-fast: false
name: Py ${{ matrix.python-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Prepare Ubuntu xvfb
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libxkbcommon-x11-0 xvfb
- name: Run tk script (closes itself after 5 seconds) - Ubuntu
if: runner.os == 'Linux'
run: xvfb-run python tk_min.py
- name: Run tk script (closes itself after 5 seconds)
if: runner.os != 'Linux'
run: python tk_min.py
17 changes: 17 additions & 0 deletions tk_min.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple Hello World! Tkinter GUI app that closes itself after 5 seconds.
"""
import tkinter as tk


root = tk.Tk()

label = tk.Label(root, text="Hello World!")
label.pack(padx=20, pady=20)

# Close the Window after 5 seconds
root.after(5000, root.destroy)

root.mainloop()

0 comments on commit a216015

Please sign in to comment.