본문 바로가기

Programming320

electron 실행파일 만들기(electron-packager) 1. Electron-packager 설치 npm install electron-packager --save-dev 2. package.json파일 수정 - "scripts" 내부의 "build" 부분을 추가해 줍니다. phonebook이라고 되어있는 부분이 실행앱 이름이 됩니다. { "name": "electron-quick-start", "version": "1.0.0", "description": "A minimal Electron application", "main": "main.js", "scripts": { "start": "electron .", "build": "electron-packager . phonebook" }, "repository": "https://github.com/elec.. 2020. 7. 5.
Javascript postgresql 연동 const { Client } = require('pg'); const client = new Client({ host : 'localhost', database: 'postgres', user: 'postgres', password: 'asdf4416', port: 5432, }); client.connect(); client.query('SELECT * FROM member', (err, res) =>{ if(err){ console.log(err); }else{ console.log(res); } }); 2020. 6. 29.
wxPython Grid에 pandas dataframe 출력하기 import wx import wx.grid as gridlib import os import psycopg2 import pandas as pd class MyFrame(wx.Frame): def __init__(self): #-------- 1. GUI 초기화 wx.Frame.__init__(self, parent=None, title="DB to Table") self.SetSize(1020, 600) self.mainPanel = wx.Panel(self) self.vtBoxSizer = wx.BoxSizer(wx.VERTICAL) # 전체 레이아웃 self.vhBoxSizer = wx.BoxSizer(wx.HORIZONTAL) # 전체 레이아웃 self.query_txt = wx.TextCtrl.. 2020. 6. 23.
wxpython GridBagSizer 예제 쉽게 레이아웃을 구성할 수 있는 GridBagSizer 예제입니다. import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, parent=None, title="GridBagSizer Example") sizer = wx.GridBagSizer(9, 9) #GridBagSizer.add(아이템, 가상그리드 위치(행, 열), 크기(높이, 넓이), 정렬상수, 여백) sizer.Add(wx.Button(self, -1, "Button"), (0, 0), wx.DefaultSpan, wx.ALL, 0) sizer.Add(wx.Button(self, -1, "Button"), (1, 1), (1, 1), wx.EXPAND) siz.. 2020. 6. 21.
pandas CSV파일 읽기 - 인코딩 에러 이런 데이터가 CSV파일로 저장되어 있다고 할 때, 1. 인코딩이 부분이 없을 경우 에러가 발생 가능합니다. 우리나라에서 작성하였다면 아래와 같이 코드를 추가하던지, 아니면 CSV의 인코딩을 수정해서 저장하던지 해야 에러가 발생하지 않습니다.. 2. pandas를 이용해서 필터링 할 때에는 df['칼럼']='조건' 으로만 해서는 True/False만 표시하기 때문에, df 안에서 해당 조건을 표시하면(아래 코드 확인) True/False를 기준으로 인덱싱 된 결과를 볼 수 있습니다. 3. head와 tail은 기본적으로 앞/뒤 5개의 데이터를 보여주지만, 내부에 숫자를 넣으면 해당 갯수만큼 출력해줍니다. import pandas as pd df = pd.read_csv('test.csv', encodin.. 2020. 6. 21.
wxpython 폴더 트리 컨트롤 import wx import wx.grid as gridlib import os class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, parent=None, title="FlexGridSizer Example") self.SetSize(1020, 600) self.mainPanel = wx.Panel(self) self.vtBoxSizer = wx.BoxSizer(wx.HORIZONTAL) # 전체 레이아웃 self.fgridSizer1 = wx.FlexGridSizer(rows=2, cols=1, hgap=5, vgap=5) # 좌측 레이아웃 self.fgridSizer2 = wx.FlexGridSizer(rows=2, cols=1.. 2020. 6. 18.