Skip to content

Commit

Permalink
added more examples, updated presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fracpete committed Dec 13, 2021
1 parent 6b6970c commit 73ccdd3
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 2021/2021-12-13/1-hello_world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# hello world

Simply prints *hello world* to the console, has no dependencies itself.

## Setup

```
virtualenv -p /usr/bin/python3 venv
./venv/bin/pip install -r requirements.txt
```

## Execution

```
./venv/bin/pyinstaller hello_world.py
```

1 change: 1 addition & 0 deletions 2021/2021-12-13/1-hello_world/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyinstaller
17 changes: 17 additions & 0 deletions 2021/2021-12-13/2-with_dependencies/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# With Dependencies

Outputs a numpy matrix with random values.

## Setup

```
virtualenv -p /usr/bin/python3 venv
./venv/bin/pip install -r requirements.txt
```

## Execution

```
./venv/bin/pyinstaller --hidden-import numpy --name with_dependencies runner.py
```

2 changes: 2 additions & 0 deletions 2021/2021-12-13/2-with_dependencies/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyinstaller
numpy
17 changes: 17 additions & 0 deletions 2021/2021-12-13/3-gtk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# GTK

GTK user interface constructed from code.

## Setup

```
virtualenv -p /usr/bin/python3 venv
./venv/bin/pip install -r requirements.txt
```

## Execution

```
./venv/bin/pyinstaller gui.py
```

23 changes: 23 additions & 0 deletions 2021/2021-12-13/3-gtk/gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk


class MyWindow(Gtk.Window):
def __init__(self):
super().__init__(title="Hello World")

self.button = Gtk.Button(label="Click Here")
self.button.connect("clicked", self.on_button_clicked)
self.add(self.button)

def on_button_clicked(self, widget):
print("Hello World")


win = MyWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()

2 changes: 2 additions & 0 deletions 2021/2021-12-13/3-gtk/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyinstaller
pygobject
17 changes: 17 additions & 0 deletions 2021/2021-12-13/4-gtk_with_glade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# GTK

GTK user interface constructed from Glade-generated XML file.

## Setup

```
virtualenv -p /usr/bin/python3 venv
./venv/bin/pip install -r requirements.txt
```

## Execution

```
./venv/bin/pyinstaller --add-data glade_gui.glade:. glade_gui.py
```

74 changes: 74 additions & 0 deletions 2021/2021-12-13/4-gtk_with_glade/glade_gui.glade
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window_main">
<property name="name">window_main</property>
<property name="can_focus">False</property>
<property name="default_width">440</property>
<property name="default_height">250</property>
<child type="titlebar">
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-dnd</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_exit">
<property name="label" translatable="yes">Exit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="gtk_main_quit" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
23 changes: 23 additions & 0 deletions 2021/2021-12-13/4-gtk_with_glade/glade_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import gi
import os

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk


class MyWindow(Gtk.Window):
def __init__(self, builder):
super().__init__(title="Hello Glade")
builder.connect_signals(self)
window = builder.get_object("window_main")
window.show_all()
Gtk.main()

def gtk_main_quit(self, *args):
Gtk.main_quit(*args)


builder = Gtk.Builder()
builder.add_from_file(os.path.dirname(__file__) + "/glade_gui.glade")
MyWindow(builder)

2 changes: 2 additions & 0 deletions 2021/2021-12-13/4-gtk_with_glade/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyinstaller
pygobject
Binary file modified 2021/2021-12-13/pyinstaller.odp
Binary file not shown.
Binary file modified 2021/2021-12-13/pyinstaller.pdf
Binary file not shown.

0 comments on commit 73ccdd3

Please sign in to comment.