|
1- |
Py-PSO-Imp
Python program, PSO -
Implementation of the Particle swarm optimization, the Machine Learning |
|
|
| |
|
|
-
Py-PSO-Imp Python program, the Implementation of
the Particle swarm optimization (PSO) at the
Machine Learning
- Create a new Python project In Visual Studio
2022
- the
Microsoft Visual Studio (... or 2019 or 2022) is
a powerful IDE for Python language
- Open/Run
Microsoft Visual Studio 2022
- To view
Python templates, search for python.
 |
Select the
Python
Application template, and select
Next. |
- Create a new Python project In
Visual Studio 2022
On the Configure your new project screen
- (specify a name and file location
for the project, and then select Create)
Project name:
Py-PSO-Imp
Location:
C:\Users\...\source\repos
(default location for Visual
Studio 2022)
|
- The new project opens in Visual Studio
2022 - (Visual Studio 2022
Compiler - IDE, to compile Python project /
file )
- The
Visual Studio Solution Explorer window shows the
project structure
- Python
Project Properieties - Py-PSO-Imp
- Projct
Folder: C:\Users\...\source\repos\Py-PSO-Imp
- Startup
File: Py_PSO_Imp.py
- Project
file: Py-PSO-Imp.sln
|
- Download Python
Project : Py-PSO-Imp.zip -
(70.0 KB zip file) Download
- Project
consist of:
One Python Form -
(Py_PSO_Imp.py )
|
 | |
|
Download Python
Project : Py-PSO-Imp.zip -
(70.0 KB zip file) Download
|
|
|
- Install numpy and matplotlib in Python on Windows
Operating System, Using Command Prompt
| 1- Install numpy in Python on Windows
Operating System, Using Command Prompt |
| pip install numpy |
| |
| 2- Install matplotlib in Python on Windows Operating System,
Using Command Prompt |
| pip install matplotlib |
| |
| |
Source Code of Python Project Py-PSO-Imp:
|
Download this Source Code at
python file: Py_PSO_Imp.py - (800 Byte Python file)
download
|
 |
Continue
|
Py-PSO-Imp
Python program, the Implementation of the
PSO at the Machine Learning | |
|
|
| |
import
numpy
as np
import
matplotlib.pyplot
as
plt
def
f(x,y):
"Objective function"
return
(x-3.14)**2 + (y-2.72)**2 + np.sin(3*x+1.41) +
np.sin(4*y-1.73)
# Contour plot: With the global minimum
showed as "X" on the plot
x, y =
np.array(np.meshgrid(np.linspace(0,5,100),
np.linspace(0,5,100)))
z = f(x, y)
print ("f(x,
y) == ",
z)
x_min = x.ravel()[z.argmin()]
y_min = y.ravel()[z.argmin()]
plt.figure(figsize=(8,6))
plt.title( "Contour
plot: With the global minimum showed")
plt.imshow(z, extent=[0, 5, 0, 5], origin= 'lower',
cmap='viridis',
alpha=0.5)
plt.colorbar()
plt.plot([x_min], [y_min], marker= 'x',
markersize=5, color="white")
contours = plt.contour(x, y, z, 10, colors= 'black',
alpha=0.4)
plt.clabel(contours, inline= True,
fontsize=8, fmt="%.0f")
plt.show() |
|
| | |
|
|
- Debug of Python Project Py-PSO-Imp, 0 Errors
Output of Python Project Py-PSO-Imp:
| |
| 1-Info: |
|
 |
| |
|
2- the Plot -plt.show |
|
 |
|
| | | |
| |
|
|
2- |
Py-PSO
Python program, PSO - the Particle swarm optimization animate |
|
|
| |
|
|
-
Py-PSO Python program, PSO - the
Particle swarm optimization animate
1- Print Info ...
2- Steps of PSO: algorithm update and save or
Plot it, Imge fille - PSO.gif
- Create a new Python project In Visual Studio
2022
- the
Microsoft Visual Studio (... or 2019 or 2022) is
a powerful IDE for Python language
- Open/Run
Microsoft Visual Studio 2022
- To view
Python templates, search for python.
 |
Select the
Python
Application template, and select
Next. |
- Create a new Python project In
Visual Studio 2022
On the Configure your new project screen
- (specify a name and file location
for the project, and then select Create)
Project name:
Py-PSO
Location:
C:\Users\...\source\repos
(default location for Visual
Studio 2022)
|
- The new project opens in Visual Studio
2022 - (Visual Studio 2022
Compiler - IDE, to compile Python project /
file )
- The
Visual Studio Solution Explorer window shows the
project structure
- Python
Project Properieties - Py-PSO
- Projct
Folder: C:\Users\...\source\repos\Py-PSO
- Startup
File: Py_PSO.py
- Project
file: Py-PSO.sln
|
- Download Python
Project : Py-PSO.zip -
(5.71 KB zip file) Download
- Project
consist of:
One Python Form -
(Py_PSO.py )
|
 | |
|
Download Python
Project : Py-PSO.zip -
(5.71 KB zip file) Download
|
|
|
- Install numpy and
matplotlib in Python on Windows
Operating System, Using Command Prompt
| 1- Install numpy in Python on Windows
Operating System, Using Command Prompt |
| pip install numpy |
| |
| 2- Install matplotlib in Python on Windows Operating System,
Using Command Prompt |
| pip install matplotlib |
| |
| |
Source Code of Python Py-PSO
project:
|
Download this Source Code at
python file: Py_PSO.py - (3.27 KB Python file)
download
|
 |
Continue
|
Py-PSO
Python program, PSO - the Particle swarm
optimization animate -
(python file :Py_PSO.py) | |
|
|
| |
import
sys
import
numpy
as np
import
matplotlib.pyplot
as
plt
from
matplotlib.animation
import
FuncAnimation
def
f(x,y):
#"Objective function"
return
(x-3.14)**2 + (y-2.72)**2 + np.sin(3*x+1.41) +
np.sin(4*y-1.73)
# Compute and plot the function in 3D within
[0,5]x[0,5]
x, y =
np.array(np.meshgrid(np.linspace(0,5,100),
np.linspace(0,5,100)))
z = f(x, y)
# Find the global minimum
x_min = x.ravel()[z.argmin()]
y_min = y.ravel()[z.argmin()]
# Hyper-parameter of the algorithm
c1 = c2 = 0.1
w = 0.8
# Create particles
n_particles = 20
np.random.seed(100)
X = np.random.rand(2, n_particles) * 5
V = np.random.randn(2, n_particles) * 0.1
# Initialize data
pbest = X
pbest_obj = f(X[0], X[1])
gbest = pbest[:, pbest_obj.argmin()]
gbest_obj = pbest_obj.min()
def
update():
#"Function to do one iteration of particle swarm
optimization"
global
V, X, pbest, pbest_obj, gbest, gbest_obj
# Update params
r1, r2 = np.random.rand(2)
V = w * V + c1*r1*(pbest - X) + c2*r2*(gbest.reshape(-1,1)-X)
X = X + V
obj = f(X[0], X[1])
pbest[:, (pbest_obj >= obj)] = X[:, (pbest_obj
>= obj)]
pbest_obj = np.array([pbest_obj,
obj]).min(axis=0)
gbest = pbest[:, pbest_obj.argmin()]
gbest_obj = pbest_obj.min()
# Set up base figure: The contour map
fig, ax = plt.subplots(figsize=(8,6))
fig.set_tight_layout( True)
img = ax.imshow(z, extent=[0, 5, 0, 5],
origin= 'lower',
cmap='viridis',
alpha=0.5)
fig.colorbar(img, ax=ax)
ax.plot([x_min], [y_min], marker= 'x',
markersize=5, color="white")
contours = ax.contour(x, y, z, 10, colors= 'black',
alpha=0.4)
ax.clabel(contours, inline= True,
fontsize=8, fmt="%.0f")
pbest_plot = ax.scatter(pbest[0], pbest[1],
marker= 'o',
color='black',
alpha=0.5)
p_plot = ax.scatter(X[0], X[1], marker= 'o',
color='blue',
alpha=0.5)
p_arrow = ax.quiver(X[0], X[1], V[0], V[1],
color= 'blue',
width=0.005,
angles= 'xy',
scale_units='xy',
scale=1)
gbest_plot = plt.scatter([gbest[0]],
[gbest[1]], marker= '*',
s=100, color='black',
alpha=0.4)
ax.set_xlim([0,5])
ax.set_ylim([0,5])
def
animate(i):
#"Steps of PSO: algorithm update and save
or Plot it"
title =
'Steps of PSO {:02d}'.format(i)
# Update params
update()
# Set picture
ax.set_title(title)
pbest_plot.set_offsets(pbest.T)
p_plot.set_offsets(X.T)
p_arrow.set_offsets(X.T)
p_arrow.set_UVC(V[0], V[1])
gbest_plot.set_offsets(gbest.reshape(1,-1))
return
ax, pbest_plot, p_plot, p_arrow, gbest_plot
print ("PSO
found best solution at f({})={}".format(gbest,
gbest_obj))
print ("Global
optimal at f({})={}".format([x_min,y_min],
f(x_min,y_min)))
print ("len(sys.argv)
= ",
len(sys.argv))
print ("sys.argv[1]
= ",
sys.argv[0])
#-------------
if
__name__ ==
'__main__':
# FuncAnimation will call the 'update' function
for each frame; here
# animating over 10 frames, with an interval of
200ms between frames.
anim = F uncAnimation(fig,
animate,
frames= list(range(1,50)),
interval=500, blit=False,
repeat=True)
if
len(sys.argv)
== 1:
anim.save( "PSO.gif",
dpi=120, writer="imagemagick")
print("PSO.gif
- saved ")
else:
# plt.show() will just loop the animation
forever.
plt.show()
print("PSO.gif
- show/plot ") |
|
| | |
|
|
- Debug of Py-PSO project, 0 Errors
Output of Py-PSO project:
| |
|
1-Info: |
 |
|
|
|
2- PSO.gif file saved |
|
 |
|
| | | |
| |
|
|
3- |
Py-PSO-animate-window
Python program, the Particle swarm optimization animate Form |
|
|
| |
|
|
-
Py-PSO-animate-window Python program,
the Particle swarm optimization animate Form
- Display the Values of the Statistical
Hypothesis Tests
- Particle Swarm Optimization - PSO:
* the Image Saved - PSO-animate-w.gif
* Show/Plot the image, PSO-animate-w.gif
|
| |
- Create a new Python project In Visual Studio
2022
- the
Microsoft Visual Studio (... or 2019 or 2022) is
a powerful IDE for Python language
- Open/Run
Microsoft Visual Studio 2022
- To view
Python templates, search for python.
 |
Select the
Python
Application template, and select
Next. |
- Create a new Python project In
Visual Studio 2022
On the Configure your new project screen
- (specify a name and file location
for the project, and then select Create)
Project name:
Py-PSO-animate-window
Location:
C:\Users\...\source\repos
(default location for Visual
Studio 2022)
|
- The new project opens in Visual Studio
2022 - (Visual Studio 2022
Compiler - IDE, to compile Python project /
file )
- The
Visual Studio Solution Explorer window shows the
project structure
- Python
Project Properieties - Py-PSO-animate-window
- Projct
Folder: C:\Users\...\source\repos\Py-PSO-animate-window
- Startup
File: Py_PSO_animate_window
- Project
file:
Py-PSO-animate-window.sln
|
- Download Python
Project : Py-PSO-animate-window.zip -
(5.67 KB zip file) Download
- Project
consist of:
One Python Form -
(Py_PSO_animate_window )
|
 | |
|
Download Python
Project : Py-PSO-animate-window.zip -
(5.67 KB zip file) Download
|
|
|
- Install numpy, matplotlib and
statsmodels in Python on Windows
Operating System, Using Command Prompt
| 1- Install numpy in Python on Windows
Operating System, Using Command Prompt |
|
pip install numpy |
| |
| 2- Install matplotlib in Python on Windows Operating System,
Using Command Prompt |
|
pip install matplotlib |
| |
| 3- Install statsmodels in Python on Windows Operating System,
Using Command Prompt - pip install
statsmodels |
|
 |
| |
| |
Source Code, Py-PSO-animate-window
project:
|
Download this Source Code at
python file: Py_PSO_animate_window - (12.3 KB Python file)
download
|
 |
Continue
|
Py-PSO-animate-window Python program, the
Particle swarm optimization animate Form
- (python file :Py_PSO_animate_window) | |
|
|
| |
# This Python file uses the
following encoding: utf-8
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import tkinter as tk
from tkinter import *
def on_closing():
root.destroy()
root = Tk()
root.title("The Machine Learning, Particle Swarm
Optimization - PSO, Window Form")
root.eval('tk::PlaceWindow . center')
window_height = 700
window_width = 1000
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x_cordinate = int((screen_width/2) - (window_width/2))
y_cordinate = int((screen_height/2) - (window_height/2))
root.geometry("{}x{}+{}+{}".format(window_width,
window_height, x_cordinate, y_cordinate))
root.resizable(0, 0)
#Labels
lbselected1=Label(root,text="1- Statistical
Hypothesis Tests",font=("Times New Roman",
12,"bold"), foreground="#000080")
lbselected1.place(x=17, y=3)
#lbselected2=Label(root,text="
-------------------------------------------------------------",font=("Times
New Roman", 10), foreground="#000080")
#lbselected2.place(x=17, y=24)
lbline1=Label(root,text="you will discover
estimation statistics that may be used as an
alternative to statistical hypothesis
tests.",font=("Times New Roman", 10))
lbline1.place(x=17, y=30)
lbline2=Label(root,text="Statistical hypothesis
tests can be used to indicate whether the
difference between two samples is due to random
chance, but cannot comment on the size of the
difference.",font=("Times New Roman", 10))
lbline2.place(x=17, y=50)
lbline3=Label(root,text="A group of methods
referred to as \textit{new statistics} are
seeing increased use instead",font=("Times New
Roman", 10))
lbline3.place(x=17, y=70)
lbline4=Label(root,text=" of or in addition to
p-values in order to quantify the magnitude of
effects and the amount of uncertainty for
",font=("Times New Roman", 10))
lbline4.place(x=17, y=90)
lbline4a=Label(root,text=" estimated values.
This group of statistical methods is referred to
as estimation statistics.",font=("Times New
Roman", 10))
lbline4a.place(x=17, y=110)
lbline5=Label(root,text="Estimation statistics
is a term to describe three main classes of
methods. The three main classes of methods
include:",font=("Times New Roman", 10))
lbline5.place(x=17, y=130)
lbline6=Label(root,text=" 1- Effect Size.
Methods for quantifying the size of an effect
given a treatment or intervention.",font=("Times
New Roman", 10))
lbline6.place(x=17, y=150)
lbline7=Label(root,text=" 2- Interval
Estimation. Methods for quantifying the amount
of uncertainty in a value.",font=("Times New
Roman", 10))
lbline7.place(x=17, y=170)
lbline8=Label(root,text=" 3- Meta-Analysis.
Methods for quantifying the findings across
multiple similar studies.",font=("Times New
Roman", 10))
lbline8.place(x=17, y=190)
lbline9=Label(root,text="Of the three, perhaps
the most useful methods in applied machine
learning are interval estimation.",font=("Times
New Roman", 10))
lbline9.place(x=17, y=210)
lbline10=Label(root,text="There are three main
types of intervals. They are:",font=("Times New
Roman", 10))
lbline10.place(x=17, y=230)
lbline11=Label(root,text=" 1- Tolerance
Interval: The bounds or coverage of a proportion
of a distribution with a specific level of
confidence.",font=("Times New Roman", 10))
lbline11.place(x=17, y=250)
lbline12=Label(root,text=" 2- Confidence
Interval: The bounds on the estimate of a
population parameter.",font=("Times New Roman",
10))
lbline12.place(x=17, y=270)
lbline13=Label(root,text=" 3- Prediction
Interval: The bounds on a single
observation.",font=("Times New Roman", 10))
lbline13.place(x=17, y=290)
lbline14=Label(root,text="A simple way to
calculate a confidence interval for a
classification algorithm is to calculate the
binomial proportion confidence interval,",font=("Times
New Roman", 10))
lbline14.place(x=17, y=310)
lbline15=Label(root,text=" which can provide an
interval around a model's estimated accuracy or
error.",font=("Times New Roman", 10))
lbline15.place(x=17, y=330)
lbline16=Label(root,text="This can be
implemented in Python using the conf_int()
statsmodels function.",font=("Times New Roman",
10))
lbline16.place(x=17, y=350)
lbline17=Label(root,text="The function takes the
count of successes (or failures), the total
number of trials, and the significance level as
arguments and returns ",font=("Times New Roman",
10))
lbline17.place(x=17, y=370)
lbline18=Label(root,text=" the lower and upper
bound of the confidence interval.",font=("Times
New Roman", 10))
lbline18.place(x=17, y=390)
lblinex=Label(root,text="------------------------------------------",font=("Times
New Roman", 12))
lblinex.place(x=350, y=410)
lbline19=Label(root,text="The example below
demonstrates this function in a hypothetical
case where a model made 88 correct predictions
out of a dataset ",font=("Times New Roman", 10))
lbline19.place(x=17, y=430)
lbline20=Label(root,text=" with 100 instances
and we are interested in the 95% confidence
interval (provided to the function as a
significance of 0.05).",font=("Times New Roman",
10))
lbline20.place(x=17, y=450)
#The example below demonstrates this function in
a hypothetical case where a model made 88
correct predictions out of a dataset with 100
instances and we are interested in the 95%
confidence interval (provided to the function as
a significance of 0.05).
#Run the example and review the confidence
interval on the estimated accuracy.
# Display the Code, to Calculate the Confidence
Interval
Frame1 = tk.Frame(root)
Frame1.place(relx=0.01, rely=0.67, relheight=0.16,
relwidth=0.48)
Frame1.configure(relief="groove", borderwidth="0",
background="#ffffff", highlightbackground="#ffffff",
highlightcolor="black", width=870)
Text11 = tk.Text(Frame1, borderwidth="0")
# to Calculate the Confidence Interval
# Create label
l = Label(Frame1, text = "the Code, to Calculate
the Confidence Interval", background="#ffffff")
l.config(font =("Times New Roman", 12))
Fact = """from statsmodels.stats.proportion
import proportion_confint
# calculate the interval
lower, upper = proportion_confint(88, 100, 0.05)
print('lower=%.3f, upper=%.3f' % (lower,
upper))"""
#Run the example and review the confidence
interval on the estimated accuracy.
l.pack()
Text11.pack()
# Insert The Fact.
Text11.insert(tk.END, Fact)
Frame2 = tk.Frame(root)
Frame2.place(relx=0.52, rely=0.67, relheight=0.16,
relwidth=0.47)
Frame2.configure(relief="groove", borderwidth="0",
background="#ffffff", highlightbackground="#ffffff",
highlightcolor="black", width=870)
#The example below demonstrates this function in
a hypothetical case where a model made 88
correct predictions out of a dataset with 100
instances and we are interested in the 95%
confidence interval (provided to the function as
a significance of 0.05).
#Run the example and review the confidence
interval on the estimated accuracy.
# to Calculate Correlation Coefficient
from statsmodels.stats.proportion import
proportion_confint
# calculate the interval
lower, upper = proportion_confint(88, 100, 0.05)
print('lower=%.3f, upper=%.3f' % (lower, upper))
# Create label
l2 = Label(Frame2, text = "the Values to
Calculate the Confidence Interval",
background="#ffffff")
l2.config(font =("Times New Roman", 12))
l2.pack()
lower1 = tk.StringVar()
upper1 = tk.StringVar()
#lower, upper = proportion_confint(88, 100,
0.05)
lower1 = lower
upper1 = upper
mylabellower0 = Label(Frame2, text ="Lower =",
font=("Times New Roman", 12), relief = FLAT,
background="#ffffff")
mylabellower0.place(x=40, y=40)
mylabellower1 = tk.Label(Frame2, width=20,
text=lower1)
mylabellower1.place(x=170, y=40)
mylabelupper0 = Label(Frame2, text ="Upper =",
font=("Times New Roman", 12), relief = FLAT,
background="#ffffff")
mylabelupper0.place(x=40, y=80)
mylabelupper1 = tk.Label(Frame2, width=20,
text=upper1)
mylabelupper1.place(x=170, y=80)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import tkinter as tk
from tkinter import *
def f (x,y):
#"Objective function"
return (x-3.14 )**2 + (y-2.72 )**2 +
np.sin(3*x+1.41) + np.sin(4*y-1.73)
# Compute and plot the function in 3D within
[0,5]x[0,5]
x, y = np.array(np.meshgrid(np.linspace(0 ,5
,100 ), np.linspace(0 ,5 ,100 )))
z = f(x, y)
# Find the global minimum
x_min = x . ravel()[z.argmin()]
y_min = y . ravel()[z.argmin()]
# Hyper-parameter of the algorithm
c1 = c2 = 0.1
w = 0.8
# Create particles
n_particles = 20
np . random .seed(100 )
X = np . random . rand(2, n_particles) * 5
V = np . random . randn(2, n_particles) * 0.1
# Initialize data
pbest = X
pbest_obj = f(X[0], X[1])
gbest = pbest[:, pbest_obj.argmin()]
gbest_obj = pbest_obj.min()
def update():
#"Function to do one iteration of particle swarm
optimization"
global V, X, pbest, pbest_obj, gbest, gbest_obj
# Update params
r1, r2 = np . random . rand(2 )
V = w * V + c1*r1*(pbest - X) + c2*r2*(gbest.
reshape(-1 ,1 )-X)
X = X + V
obj = f(X[0], X[1])
pbest[:, (pbest_obj >= obj)] = X[:, (pbest_obj
>= obj)]
pbest_obj = np .array([pbest_obj, obj]) .min(axis=0
)
gbest = pbest[:, pbest_obj.argmin()]
gbest_obj = pbest_obj.min()
# Set up base figure: The contour map
fig, ax = plt.subplots(figsize= (8 ,6 ))
fig.set_tight_layout(True )
img = ax .imshow(z, extent= [0 , 5 , 0 , 5 ],
origin= 'lower' , cmap= 'viridis' , alpha=0.5 )
fig.colorbar(img, ax=ax)
ax .plot([x_min], [y_min], marker= 'x' ,
markersize=5 , color="white" )
contours = ax .contour(x, y, z, 10 , colors=
'black' , alpha=0.4 )
ax .clabel(contours, inline=True , fontsize=8 ,
fmt="%.0f" )
pbest_plot = ax .scatter(pbest[0 ], pbest[1 ],
marker= 'o' , color= 'black' , alpha=0.5 )
p_plot = ax .scatter(X[0], X[1], marker= 'o' ,
color= 'blue' , alpha=0.5 )
p_arrow = ax .quiver(X[0], X[1], V[0], V[1],
color= 'blue' , width=0.005 , angles= 'xy' ,
scale_units= 'xy' , scale=1 )
gbest_plot = plt.scatter([gbest[0 ]], [gbest[1
]], marker= '*' , s=100, color= 'black' ,
alpha=0.4 )
ax .set_xlim([0 ,5 ])
ax .set_ylim([0 ,5 ])
def animate (i):
#"Steps of PSO animate: algorithm update and
show in plot"
title = 'PSO Animate Window {:02d} ' .format(i)
# Update params
update()
# Set picture
ax . set_title(title)
pbest_plot. set_offsets(pbest.T)
p_plot. set_offsets(X.T)
p_arrow . set_offsets(X.T)
p_arrow . set_UVC(V[0], V[1])
gbest_plot. set_offsets(gbest. reshape(1 ,-1 ))
return ax, pbest_plot, p_plot, p_arrow,
gbest_plot
#####
#1-anim .save() will just loop the animation
forever.
def AnimSav():
anim = FuncAnimation(fig, animate, frames= list
( range (1 ,50 )), interval=500 , blit=False,
repeat=False ) #repeat=True )
anim .save("PSO-animate-w.gif", dpi=120 ,
writer="imagemagick")
#2-plt.show() will just loop the animation
forever.
def AnimShow():
anim = FuncAnimation(fig, animate, frames= list
( range (1 ,50 )), interval=500 , blit=False,
repeat=False ) #repeat=True )
# 2- plt.show() will just loop the animation
forever.
plt.show()
lbselectedpso=Label(root,text="2- Particle Swarm
Optimization - PSO:",font=("Times New Roman",
12,"bold"), foreground="#000080")
lbselectedpso.place(x=17, y=585)
lbselectedpso=Label(root,text=" It Is a
computational method that optimizes a problem by
iteratively trying to improve a candidate
solution with regard to a given measure of
quality.",font=("Times New Roman", 10,"bold"),
foreground="#000080")
lbselectedpso.place(x=17, y=605)
option= Button(root, text ="Save the image,
PSO-animate-w.gif", command = AnimSav, bd =1,
font=("Times New Roman",12), bg =
"#118ab2",fg="#eae2b7")
option.place(x=40, y=630, width = 500, height =
25)
option1= Button(root, text ="Show/Plot the
image, PSO-animate-w.gif", command = AnimShow,
bd =1, font=("Times New Roman",12), bg =
"#118ab2",fg="#eae2b7")
option1.place(x=40, y=670, width = 500, height =
25)
#Button
close = Button(root, text = "Done", command =
on_closing)
close.place(x=850, y=650, height = 30, width =
120)
root.mainloop() |
|
| | |
|
|
- Debug Py-PSO-animate-window project, 0 Errors
Output of Py-PSO-animate-window
project
| 1- Py-PSO-animate-window
Form |
|
|
|
|
|
2- the Image Saved ,PSO-animate-w.gif
at C:\Users\...\source\repos\Py-PSO-animate-window\Py-PSO-animate-window |
|
 |
|
|
|
3- Show/Plot the image,
PSO-animate-w.gif |
|
 |
|
|
|
4- Resultat of Print
Values of Output Py-PSO-animate-window
project |
|
 |
|
| | | |
| |
|
|