質問編集履歴

1

修正

2020/12/16 05:48

投稿

3939TJ55
3939TJ55

スコア109

test CHANGED
File without changes
test CHANGED
@@ -16,10 +16,274 @@
16
16
 
17
17
  ```python
18
18
 
19
+ #ライブラリインポート
20
+
21
+ import tkinter as tk
22
+
23
+ import tkinter.messagebox as tkm
24
+
25
+ from tkinter.scrolledtext import ScrolledText
26
+
27
+ import tkinter.ttk as ttk
28
+
29
+ import cx_Oracle
30
+
31
+ import os
32
+
33
+ import csv
34
+
35
+ import pandas as pd
36
+
37
+ import textwrap
38
+
39
+
40
+
41
+ #情報
42
+
43
+ desktop_path = os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH") + "\Desktop"+"\"
44
+
45
+ names = ["配布先","品番表示","枝番表示","商品名1","商品名2","税率","税込小売価格","本体小売価格","税込卸価格","本体卸価格","入数表示","出力枚数","入力者番号"]
46
+
47
+ df = pd.DataFrame(columns=names)
48
+
49
+
50
+
51
+ def btn_click1():
52
+
53
+ pass
54
+
55
+ df.to_csv("_{}.csv", index= False,encoding="shift-jis")
56
+
57
+ tkm.showinfo("情報", "CSVを保存しました")
58
+
59
+
60
+
61
+ def btn_click():
62
+
63
+
64
+
65
+ haihin = str(txt1.get())
66
+
67
+ hinmei = "\n".join(textwrap.wrap(txt4.get('1.0', 'end -1c'), width=23))
68
+
69
+ code= str(txt2.get())
70
+
71
+ mai= str(txt5.get())
72
+
73
+ tree.insert("", "end", tags=i,values=(code,hinmei,mai,1,1,1,1,1,1))
74
+
75
+
76
+
77
+ #画面表示
78
+
79
+ root = tk.Tk()
80
+
81
+ root.geometry('1300x800+250+100')
82
+
83
+ root.title('入力画面')
84
+
85
+ root.minsize(width=1300, height=800)
86
+
87
+
88
+
89
+ #配布先FLBX
90
+
91
+ lbl1 = tk.Label(text='配布先FLBX',relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
92
+
93
+ lbl1.place(x=10, y=18)
94
+
95
+ txt1 = tk.Entry(width=10)
96
+
97
+ txt1.place(x=105, y=20)
98
+
99
+
100
+
101
+ #商品コード
102
+
103
+ lbl2 = tk.Label(text='商品コード',relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
104
+
105
+ lbl2.place(x=10, y=50)
106
+
107
+ txt2 = tk.Entry(width=30)
108
+
109
+ txt2.place(x=105, y=52)
110
+
111
+ lbl2_1 = tk.Label(text='10桁入力(品番/CL/SZ)',font=(u'MS ゴシック', 9, 'bold'))
112
+
113
+ lbl2_1.place(x=290, y=55)
114
+
115
+
116
+
117
+ #登録内容
118
+
119
+ lbl3 = tk.Label(text='登録内容',font=(u'MS ゴシック', 11, 'bold'))
120
+
121
+ lbl3.place(x=15, y=92)
122
+
123
+
124
+
125
+ #商品名
126
+
127
+ lbl4 = tk.Label(text='商品名',relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
128
+
129
+ lbl4.place(x=105, y=92)
130
+
19
- txt4 = tk.Text(root, font=(u'MS ゴシック', 11, 'bold'),width=23,height=2)
131
+ txt4 = tk.Text(root, font=(u'MS ゴシック', 11, 'bold'),width=23,height=2)#字数制限、要確認!!
132
+
20
-
133
+ txt4.place(x=165, y=94)
134
+
135
+ #txt4.configure(state='disabled')
136
+
137
+
138
+
139
+ #出力枚数
140
+
141
+ lbl5 = tk.Label(text='出力枚数',relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
142
+
143
+ lbl5.place(x=380, y=90)
144
+
145
+ txt5 = tk.Entry(width=20)
146
+
147
+ txt5.place(x=380, y=110)
148
+
149
+ txt5.insert(tk.END,1)
150
+
151
+
152
+
153
+ #商品情報
154
+
155
+ lbl6 = tk.Label(text='小売価格 '+ " 0,000",relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
156
+
157
+ lbl6.place(x=540, y=90)
158
+
159
+
160
+
161
+ lbl7 = tk.Label(text='本体価格 '+ " 0,000",relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
162
+
163
+ lbl7.place(x=540, y=110)
164
+
165
+
166
+
167
+ lbl8 = tk.Label(text='卸価格 '+ " 0,000",relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
168
+
169
+ lbl8.place(x=774, y=90)
170
+
171
+
172
+
173
+ lbl9 = tk.Label(text='卸本体価格 '+ " 0,000",relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
174
+
175
+ lbl9.place(x=740, y=110)
176
+
177
+
178
+
179
+ lbl10 = tk.Label(text='消費税率 '+ " 10%",relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
180
+
181
+ lbl10.place(x=954, y=90)
182
+
183
+
184
+
185
+ lbl11 = tk.Label(text='入数表示 '+ " (@×,××)",relief="ridge",font=(u'MS ゴシック', 11, 'bold'))
186
+
187
+ lbl11.place(x=954, y=110)
188
+
189
+
190
+
191
+ #登録ボタン
192
+
193
+ btn = tk.Button(root, text='登録',width=8, font=("Menlo",11), bg="yellow2",command=btn_click)
194
+
195
+ btn.place(x=1170, y=105)
196
+
197
+
198
+
199
+ #保存ボタン
200
+
201
+ btn1 = tk.Button(root, text='保存',width=8, font=("Menlo",11), bg="yellow2",command=btn_click1)
202
+
203
+ btn1.place(x=1170, y=440)
204
+
205
+
206
+
207
+ #商品コード
208
+
21
- hinmei = str(txt4.get('1.0', 'end -1c'))
209
+ lbl12 = tk.Label(text='商品コード',font=(u'MS ゴシック', 11, 'bold'))
210
+
22
-
211
+ lbl12.place(x=10, y=160)
212
+
213
+
214
+
215
+
216
+
217
+ #treeview
218
+
219
+ frame = tk.Frame()
220
+
221
+ frame.place(x=50,y=190)
222
+
223
+
224
+
225
+ tree = ttk.Treeview(frame)
226
+
227
+ tree.grid(row=0, column=0)
228
+
229
+ tree["columns"] = (1,2,3,4,5,6,7,8,9)
230
+
23
- tree.insert("", "end", tags=i,values=(code,hinmei,mai,1))
231
+ tree["show"] = "headings"
232
+
233
+
234
+
235
+ tree.column(1,width=180)
236
+
237
+ tree.column(2,width=200)
238
+
239
+ tree.column(3,width=60)
240
+
241
+ tree.column(4,width=140)
242
+
243
+ tree.column(5,width=140)
244
+
245
+ tree.column(6,width=140)
246
+
247
+ tree.column(7,width=140)
248
+
249
+ tree.column(8,width=60)
250
+
251
+ tree.column(9,width=140)
252
+
253
+
254
+
255
+ tree.heading(1,text="商品コード")
256
+
257
+ tree.heading(2,text="商品名")
258
+
259
+ tree.heading(3,text="出力枚数")
260
+
261
+ tree.heading(4,text="小売価格")
262
+
263
+ tree.heading(5,text="本体価格")
264
+
265
+ tree.heading(6,text="卸価格")
266
+
267
+ tree.heading(7,text="卸本体価格")
268
+
269
+ tree.heading(8,text="消費税率")
270
+
271
+ tree.heading(9,text="入数表示")
272
+
273
+
274
+
275
+
276
+
277
+ ysb = tk.Scrollbar(frame, orient=tk.VERTICAL, width=16, command=tree.yview)
278
+
279
+ tree.configure(yscrollcommand=ysb.set)
280
+
281
+ ysb.grid(row=0, column=1, sticky='news')
282
+
283
+
284
+
285
+ #表示保持
286
+
287
+ root.mainloop()
24
288
 
25
289
  ```