teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

修正

2020/08/12 10:56

投稿

skysoul
skysoul

スコア111

title CHANGED
File without changes
body CHANGED
@@ -104,4 +104,23 @@
104
104
  calendar_tk.mainloop()
105
105
  ```
106
106
 
107
- これの76行目の文です。このreturn文をmake_calendar関数の呼んだところにreturnしたいと思ってます
107
+ これの76行目の文です。このreturn文をmake_calendar関数の呼んだところにreturnしたいと思ってます
108
+
109
+ 追記
110
+ 「def make_date_button_push(i):
111
+
112
+ でリターンさせたら、ボタンのcommandに行きますよね?」
113
+
114
+
115
+ ```
116
+ def make_date_button_push(i):
117
+ def date_button_push():
118
+ global check
119
+ click_day = month_first_day + i-1
120
+ print(year,month,click_day)
121
+
122
+ check = 1
123
+
124
+ return year,month,click_day
125
+ ```
126
+ です

1

端折りました

2020/08/12 10:56

投稿

skysoul
skysoul

スコア111

title CHANGED
File without changes
body CHANGED
@@ -35,55 +35,7 @@
35
35
 
36
36
  window_open_flag = 0
37
37
 
38
- def before_month(year,month):
39
- month = month - 1
40
- if month == 0:
41
- month = 12
42
- year = year - 1
43
38
 
44
- month_first_day = datetime.date(year,month,1).isoweekday()
45
-
46
- if month_first_day == 7:
47
- month_first_day = 0
48
-
49
- for i in range(len(day_list)):
50
- lbl[i].destroy()
51
-
52
-
53
- # all dest.
54
- month_lbl.destroy()
55
-
56
- before_month_button.destroy()
57
-
58
- after_month_button.destroy()
59
- for i in range(len(button)):
60
- button[i].destroy()
61
-
62
- make_calendar(year, month, month_first_day)
63
-
64
- def after_month(year,month):
65
- month = month + 1
66
- if month == 13:
67
- month = 1
68
- year = year + 1
69
-
70
- month_first_day = datetime.date(year,month,1).isoweekday()
71
-
72
- if month_first_day == 7:
73
- month_first_day = 0
74
-
75
- # all dest.
76
- month_lbl.destroy()
77
-
78
- before_month_button.destroy()
79
-
80
- after_month_button.destroy()
81
-
82
- for i in range(len(button)):
83
- button[i].destroy()
84
-
85
- make_calendar(year, month, month_first_day)
86
-
87
39
  def window_open():
88
40
  global calendar_tk
89
41
  global window_open_flag
@@ -111,21 +63,8 @@
111
63
 
112
64
  if window_open_flag == 0:
113
65
  window_open()
66
+
114
67
 
115
- day_list = ['sun','mon','tue','wed','thu','fri','sat']
116
- monthlist = ['Jan','Feb','Mar','Apr','May','June','July','Aug','Sept','Oct','Nov','Dec']
117
- lbl=[0]*7
118
- year_lbl = tkinter.Label(calendar_tk, text=str(year) + '年', bg='#FFFFB3')
119
- year_lbl.grid(row=0, column=3)
120
- month_lbl = tkinter.Label(calendar_tk,text= str(month)+ '月', bg='#FFFFB3')
121
- month_lbl.grid(row=1, column=3)
122
-
123
- before_month_button = tkinter.Button(calendar_tk,text='←前の月', command=lambda:before_month(year,month))
124
- before_month_button.grid(row=1, column=2)
125
-
126
- after_month_button = tkinter.Button(calendar_tk,text='次の月→', command=lambda:after_month(year,month))
127
- after_month_button.grid(row=1, column=4)
128
-
129
68
  en_month_lbl = tkinter.Label(calendar_tk,text=monthlist[month-1], bg='#FFFFB3')
130
69
  en_month_lbl.grid(row=2, column=3)
131
70
 
@@ -133,15 +72,8 @@
133
72
  sun_color = '#FF0000'
134
73
 
135
74
  for i in range(len(day_list)):
136
- if i == 0:
137
- lbl[i] = tkinter.Label(calendar_tk, text=day_list[i], fg=sun_color, bg='#FFFFB3')
75
+ lbl[i] = tkinter.Label(calendar_tk, text=day_list[i], bg='#FFFFB3')
138
- lbl[i].grid(row=3, column=i)
76
+ lbl[i].grid(row=3, column=i)
139
- elif i == 6:
140
- lbl[i] = tkinter.Label(calendar_tk, text=day_list[i], fg=sat_color, bg='#FFFFB3')
141
- lbl[i].grid(row=3, column=i)
142
- else:
143
- lbl[i] = tkinter.Label(calendar_tk, text=day_list[i], bg='#FFFFB3')
144
- lbl[i].grid(row=3, column=i)
145
77
 
146
78
  button = [0] * calendar.monthrange(year, month)[1]
147
79
 
@@ -172,4 +104,4 @@
172
104
  calendar_tk.mainloop()
173
105
  ```
174
106
 
175
- これの146行目の文です。このreturn文をmake_calendar関数の呼んだところにreturnしたいと思ってます
107
+ これの76行目の文です。このreturn文をmake_calendar関数の呼んだところにreturnしたいと思ってます