Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/wish
- package require mysqltcl
- set mysql_handler [mysqlconnect -host {localhost} -user {root} -password {975008} ]
- mysqluse $mysql_handler {school}
- proc add_classroom { } {
- }
- wm resizable . 1 0
- label .classroom_number_lab -text "Classroom Number:" -anchor w
- entry .classroom_number_ent
- label .classroom_day_lab -text "Classroom Day:" -anchor w
- set days_of_the_week [list "sat" "sun" "mon" "tues" "wed" "thu" "fri" ]
- ttk::combobox .classroom_day_combo -width 3 -values $days_of_the_week -state readonly
- label .classroom_time_lab -text "Classroom Time: (hr:min)" -anchor w
- set hrs_of_the_day ""
- for { set i 0 } { $i<=23 } { incr i } { set hrs_of_the_day "$hrs_of_the_day $i" }
- ttk::combobox .classroom_hr_combo -width 3 -values $hrs_of_the_day -state readonly
- label .classroom_time_colon_lab -text ":" -anchor w -width 1
- set minutes_of_the_hr ""
- for { set i 0 } { $i<=59 } { incr i } { set minutes_of_the_hr "$minutes_of_the_hr $i" }
- ttk::combobox .classroom_minute_combo -width 3 -values $minutes_of_the_hr -state readonly
- label .classroom_subjects_lab -text "Select Subject:" -anchor w
- set all_subjects_query "select concat(subject.id,';',subject.name) from subject"
- set all_subjects_resutls [ mysqlsel $mysql_handler $all_subjects_query -flatlist]
- ttk::combobox .classroom_subject_combo -values $all_subjects_resutls -state readonly
- label .classroom_teachers_lab -text "Select Teacher:" -anchor w
- set all_teachers_query "select concat(teacher.id,';',teacher.name) from teacher"
- set all_teachers_resutls [ mysqlsel $mysql_handler $all_teachers_query -flatlist]
- ttk::combobox .classroom_teachers_combo -values $all_teachers_resutls -state readonly
- button .classroom_add_but -text "Add new classroom" -command { add_classroom}
- grid .classroom_number_lab -row 1 -column 1 -sticky w
- grid .classroom_number_ent -row 1 -column 2 -columnspan 2 -sticky w
- grid .classroom_day_lab -row 2 -column 1 -sticky w
- grid .classroom_day_combo -row 2 -column 2 -sticky w
- grid .classroom_time_lab -row 3 -column 1 -sticky ew
- grid .classroom_hr_combo -row 3 -column 2 -sticky ew
- grid .classroom_time_colon_lab -row 3 -column 3 -sticky ew
- grid .classroom_minute_combo -row 3 -column 4 -sticky ew
- grid .classroom_subjects_lab -row 4 -column 1 -columnspan 2 -sticky w
- grid .classroom_subject_combo -row 5 -column 1 -columnspan 2 -sticky w
- grid .classroom_teachers_lab -row 6 -column 1 -columnspan 2 -sticky w
- grid .classroom_teachers_combo -row 7 -column 1 -columnspan 2 -sticky w
- grid .classroom_add_but -row 8 -column 1 -columnspan 3 -sticky w
Add Comment
Please, Sign In to add comment