import tkinter as tk
class Form(tk.Frame):
def __init__(self, root):
super().__init__(root)
self.master = root
self.master.title('Window #1')
self.master.resizable(False, False)
self.master.geometry('500x600')
self.build()
def build(self):
frame = tk.Frame(self, width = 500, height = 600, bg = 'green')
frame.pack()
def main():
root = tk.Tk()
form = Form(root)
form.pack()
root.mainloop()
if __name__ == '__main__':
main()
Объяснение:
#include <iostream>
int main(void){
const int N = 3;
const int M = 5;
int mat[N][M];
int i, j, row = 0, col = 0, n = 1;
while(row <= (N - 1)){
i = row;
j = col;
while((i < N) && (j >= 0))
mat[i++][j--] = n++;
if(col < (M - 1))
++col;
else
++row;
}
for(i = 0; i < N; ++i){
for(j = 0; j < M; ++j){
std::cout.width(3);
std::cout << mat[i][j];
std::cout << std::endl;
return 0;
import tkinter as tk
class Form(tk.Frame):
def __init__(self, root):
super().__init__(root)
self.master = root
self.master.title('Window #1')
self.master.resizable(False, False)
self.master.geometry('500x600')
self.build()
def build(self):
frame = tk.Frame(self, width = 500, height = 600, bg = 'green')
frame.pack()
def main():
root = tk.Tk()
form = Form(root)
form.pack()
root.mainloop()
if __name__ == '__main__':
main()
Объяснение:
#include <iostream>
int main(void){
const int N = 3;
const int M = 5;
int mat[N][M];
int i, j, row = 0, col = 0, n = 1;
while(row <= (N - 1)){
i = row;
j = col;
while((i < N) && (j >= 0))
mat[i++][j--] = n++;
if(col < (M - 1))
++col;
else
++row;
}
for(i = 0; i < N; ++i){
for(j = 0; j < M; ++j){
std::cout.width(3);
std::cout << mat[i][j];
}
std::cout << std::endl;
}
return 0;
}
Объяснение: