Skip to content

Commit

Permalink
Integrated Kanapy GUI into package
Browse files Browse the repository at this point in the history
  • Loading branch information
AHartmaier committed Oct 27, 2024
1 parent ff48001 commit 52a5d8b
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 274 deletions.
37 changes: 36 additions & 1 deletion src/kanapy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import shutil
import click
from kanapy.util import MAIN_DIR, ROOT_DIR
from kanapy.util import MAIN_DIR


@click.group()
Expand All @@ -11,6 +11,41 @@ def main(ctx):
pass


@main.command(name='gui')
@click.pass_context
def gui(ctx):
""" Start Kanapy's GUI """
import matplotlib.pyplot as plt
import tkinter as tk
import tkinter.font as tkFont
from tkinter import ttk
from kanapy.gui import particle_rve, cuboid_rve

app = tk.Tk()
app.title("RVE_Generation")
screen_width = app.winfo_screenwidth()
screen_height = app.winfo_screenheight()
plt.rcParams['figure.dpi'] = screen_height / 19 # height stats_plot: 9, height voxel_plot: 6, margin: 4
window_width = int(screen_width * 0.6)
window_height = int(screen_height * 0.8)
x_coordinate = int((screen_width / 2) - (window_width / 2))
y_coordinate = 0 # int((screen_height / 2) - (window_height / 2))
app.geometry(f"{window_width}x{window_height}+{x_coordinate}+{y_coordinate}")

notebook = ttk.Notebook(app)
notebook.pack(fill='both', expand=True)
style = ttk.Style(app)
default_font = tkFont.Font(family="Helvetica", size=12, weight="bold")
style.configure('TNotebook.Tab', font=('Helvetica', '12', "bold"))
style.configure('TButton', font=default_font)

""" Start main loop """
prve = particle_rve(app, notebook) # First tab: Particle-based grains
crve = cuboid_rve(app, notebook) # Second tab: Cuboid grains
#erve = ebsd_rve() # Third tab: EBSDbased RVE
app.mainloop()


@main.command(name='runTests')
@click.option('-no_texture', default=False)
@click.pass_context
Expand Down
Loading

0 comments on commit 52a5d8b

Please sign in to comment.