Wednesday, June 16, 2021

Edward Lance Lorilla

Edward Lance Lorilla


【Visual Studio Visual Csharp】Tray Icon

Posted: 15 Jun 2021 08:39 AM PDT

 using System;

using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms; namespace showTrayC{ public partial class Form1 : Form { NotifyIcon notify = new NotifyIcon(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { notifyIcon1.Visible = true; notifyIcon1.BalloonTipIcon = ToolTipIcon.Info; notifyIcon1.BalloonTipText = "Application working..."; notifyIcon1.BalloonTipTitle = "TrayIcon example application"; notifyIcon1.ShowBalloonTip(2000); } private void Form1_Load(object sender, EventArgs e) { notifyIcon1.Visible = false; } }}

【PYTHON】Boxplots and Boxenplots

Posted: 15 Jun 2021 08:37 AM PDT

 import pandas as pd


df = pd.read_csv('itunes_data.csv')

df['Minutes'] = df['Milliseconds'] / (1000 * 60)

df['MB'] = df['Bytes'] / 1000000

df.drop(['Milliseconds', 'Bytes'], axis=1, inplace=True)


import matplotlib.pyplot as plt


df['Minutes'].plot.box()

plt.show()


df['Minutes'].plot.box()


import seaborn as sns

_ = sns.boxenplot(y=df['Minutes'])


# plot multiple columns at once

sns.boxenplot(data=df[['Minutes', 'MB']])


# save figure for book

f = plt.figure(figsize=(5.5, 5.5))  # this changes the size of the image -- more on this is chapter 5

f.patch.set_facecolor('w')  # sets background color behind axis labels

sns.boxenplot(y=df['Minutes'])

plt.tight_layout()  # auto-adjust margins

plt.savefig('B17030_05_02.png', dpi=300)


sns.boxenplot(y=df['Minutes'])

plt.yscale('log')


#@title Default title text

# save figure for book

f = plt.figure(figsize=(5.5, 5.5))  # this changes the size of the image -- more on this is chapter 5

f.patch.set_facecolor('w')  # sets background color behind axis labels

sns.boxenplot(y=df['Minutes'])

plt.yscale('log')

plt.tight_layout()  # auto-adjust margins

plt.savefig('B17030_05_03.png', dpi=300)


df['Minutes'].plot.box()

plt.yscale('log')


df['Minutes'].plot.box()

plt.yscale('log')


# another way to use a log scale

df['Minutes'].plot.box(logy=True)


df['Minutes'].describe()


【GAMEMAKER】Key Mapped

Posted: 15 Jun 2021 08:36 AM PDT

Information about object: obj_MapKey

Sprite: spr_Map
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

Mapping = false
scr_MapNames()
//you cannot use the variable "kd"
//if you want to use it, change the variable name in the scripts

//don't forget to check each of my instances' creation codes.
//go to the room I'm in, and ctrl+RightClick one of my instances.
//then click "Creation Code." You can see a few of my variables there.
//This is so each instance of me has different variable values.
Mouse Event for Left Released:
execute code:

//only this key is mapping
obj_MapKey.Mapping = false
Mapping = true
Draw Event:
execute code:

draw_set_halign(fa_center)
draw_sprite(sprite_index,-1,x,y) //draw the box
draw_text(x-48,y+8,draw_string) //draw the description
draw_text(x+112,y+8,draw_mapped) //draw the key
draw_set_halign(fa_left)
//draw an outline
draw_line(x-96,y,x+160,y)
draw_line(x-96,y,x-96,y+32)
draw_line(x-96,y+32,x+160,y+32)
draw_line(x+160,y,x+160,y+32)

//if waiting for remap, draw remap info
if Mapping {
//draw_background(bg_White,272,238)
draw_set_halign(fa_center)
draw_text(400,260,"Press Desired Key for Action:")
draw_text(400,276,draw_string)
}

Key Release Event for <any key> Key:
execute code:

if Mapping {
scr_MapSet() //remap the key pressed
}

Information about object: obj_Player
Sprite: spr_A1_W_D
Solid: true
Visible: true
Depth:
1
Persistent: true
Parent:
Children:
Mask:


No Physics Object

Create Event:
execute code:

image_speed = 0 //don't animate yet
Step Event:
execute code:

//handle movement
//notice how it checks each key based on variable
//check the room creation code to see these variables initialized
//the variables are reset (remapped) using scr_MapSet - the execute string

if keyboard_check(global.DownKey) {
//move; set sprite; animate sprite
y += 4; sprite_index=spr_A1_W_D; image_speed = .4
}
if keyboard_check(global.LeftKey) {
x -= 4; sprite_index=spr_A1_W_L; image_speed = .4
}
if keyboard_check(global.RightKey) {
x += 4; sprite_index=spr_A1_W_R; image_speed = .4
}
if keyboard_check(global.UpKey) {
y -= 4; sprite_index=spr_A1_W_U; image_speed = .4
}

//if he's not moving
if !keyboard_check(global.DownKey) && !keyboard_check(global.LeftKey)
&& !keyboard_check(global.RightKey) && !keyboard_check(global.UpKey) {
image_index = 0 //place on first frame of sprite (standing)
image_speed = 0 //stop animation
//image_single is no longer supported
}

///////////
//Set Key//
///////////
var kk;
kk = keyboard_lastkey
if kd[kk] != "" { //make sure the key has a name
draw_mapped = kd[kk] //set the drawing name to the name
if(mapped_var == "global.UpKey"){
global.UpKey = kk
}
if(mapped_var == "global.DownKey"){
global.DownKey = kk
}
if(mapped_var == "global.RightKey"){
global.RightKey = kk
}
if(mapped_var == "global.LeftKey"){
global.RightKey = kk
}
//execute_string(mapped_var+" = "+string(kk)) //set the variable to the key
Mapping = false
}

//////////////////////////
//define each key's name//
//////////////////////////
/*
This is pretty much just a collection of names for the keys.
This way, the user knows what key each thing is set to.
*/
var m;
for (m = 0; m <= 255; m += 1) { //set all keys to nameless
kd[m] = "" //only named keys can pass
}
kd[8] = "Backspace"
kd[13] = "Enter Key"
kd[16] = "Shift Key"
kd[17] = "Control Key"
kd[18] = "Alt Key"
kd[19] = "Pause/Break"
kd[27] = "Escape Key"
kd[32] = "Space Key"
kd[33] = "Page Up"
kd[34] = "Page Down"
kd[35] = "End Key"
kd[36] = "Home Key"
kd[37] = "Left Arrow"
kd[38] = "Up Arrow"
kd[39] = "Right Arrow"
kd[40] = "Down Arrow"
kd[45] = "Insert Key"
kd[46] = "Delete Key"
for (m = 65; m <= 90; m += 1) { //the letter keys
kd[m] = chr(m)+" Key" //"A Key", "Z Key"
}
for (m = 96; m <= 105; m += 1) { //the numpad keys
kd[m] = "Numpad "+string(m) //"Numpad 0", "Numpad 9"
}
kd[106] = "Multiply Key"
kd[107] = "Add Key"
kd[109] = "Subtract Key"
kd[110] = "Decimal Key"
kd[111] = "Divide Key"
for (m = 112; m <= 123; m += 1) { //the F keys
kd[m] = "F"+string(m-1)+" Key" //"F1 Key", "F12 Key"
}

No comments:

Post a Comment