How to make a landscape table fill the whole width?

always use \linewidth inside the landscape environment and not \textwidth


Here is my solution

\documentclass[dvipsnames,rgb,dvips]{book}

\usepackage[a4paper,margin=20mm,showframe]{geometry}
\usepackage{longtable}
\usepackage{array}
\usepackage{calc}
\usepackage{ltablex}
\usepackage{lscape}
\usepackage{ragged2e}

\newcounter{No}
\renewcommand{\theNo}{\stepcounter{No}\arabic{No}}
\newcolumntype{A}[1]{%
  >{\vspace*{\medskipamount}\Centering}
  p{#1\linewidth-2\tabcolsep-2\arrayrulewidth}
  <{\smallskip}}
\newenvironment{MyTable}[4]%
  {\setcounter{No}{0}%comment out this if you want to continuous numbering for all tables.
   \begin{longtable}{%
            |>{\scriptsize\theNo}A{#1}<{}%
            |>{}l<{\minipage[t]{#2\linewidth-2\tabcolsep-2\arrayrulewidth}
                   \vspace{0pt}\input{\jobname.tmp}\endminipage}%
            |>{\Centering\lstinputlisting{\jobname.tmp}}A{#3}<{}%
            |>{\scriptsize\arraybackslash}A{#4}<{}%
            |%
    }%
    \hline\ignorespaces%
}%
{%
    \end{longtable}%
}

\newcommand{\Comment}[1]{& & & #1\\\hline}

\usepackage{listings}
\lstset{%
language={PSTricks},
basicstyle=\ttfamily\scriptsize,%
keywordstyle=\color{blue}%,
%backgroundcolor=\color{yellow!30}%
}
\usepackage{fancyvrb}
\def\MyRow{%        
        \VerbatimEnvironment%
        \begin{VerbatimOut}{\jobname.tmp}}

\def\endMyRow{\end{VerbatimOut}}

\usepackage{pstricks,pst-node}
\newpsstyle{gridstyle}{%
gridwidth=0.4pt,%default: 0.8pt
gridcolor=Red!20,%default: black
griddots=0,%default: 0 
%
gridlabels=3pt,%default: 10pt
gridlabelcolor=Blue,%default: black
%
subgriddiv=5,%default: 5
subgridwidth=0.2pt,%default: 0.4pt
subgridcolor=Green!20,%default: gray
subgriddots=0%default: 0
}

\usepackage{lipsum}

\begin{document}
\chapter{Introduction to PSTricks}
\lipsum[1]

\section{At a glance galleries}
\lipsum[1-5]

%Landscape starts here.
%\pagestyle{empty}
\begin{landscape}
\noindent
\rule{\linewidth}{4pt}

\thispagestyle{empty}
\begin{MyTable}{0.05}{.25}{0.4}{0.3}%
%=============
\begin{MyRow}
\pspicture[showgrid](4,4)
\pnode(1,1){A}
\pnode(3,3){B}
\ncline{A}{B}
\endpspicture
\end{MyRow}
\Comment{\lipsum[1]}
%=============
\begin{MyRow}
\begin{pspicture}[showgrid](4,3)
\psframe*[linecolor=red!30](3,2)
\end{pspicture}
\end{MyRow}
\Comment{\lipsum[2]}
%=============
\begin{MyRow}
\pspicture[showgrid](4,3)
\psframe*[linecolor=green!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[3]}
%=============
\begin{MyRow}
\pspicture[showgrid](4,3)
\psframe*[linecolor=yellow!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[4]}
%=============
\begin{MyRow}
\pspicture[showgrid](4,3)
\psframe*[linecolor=Maroon!30](3,2)
\endpspicture
\end{MyRow}
\Comment{\lipsum[5]}
%=============
\end{MyTable}
%Landscape stops here.
\end{landscape}
%\pagestyle{plain}

\section{Node}
\lipsum[1-5]
\end{document}